Run sever
1 | FLASK_APP=manage.py FLASK_ENV=development flask run |
项目结构
1 | |- projectName |
Virtualenv
安装Library
pip3 install virtualenv
创建虚拟环境
mkdir myproject
python3 -m venv venv
激活虚拟环境
. venv/bin/activate
安装Flask
pip install Flask
退出虚拟环境
deactivate
安装依赖
生成requirements.txt
pip freeze > requirements.txt
安装requirements.txt依赖
pip install -r requirements.txt
异步任务
在Flask中使用简单异步任务
1 | from flask import Flask |
os命令
Download folder
1 | def get_download_folder(): |
Username
os.getlogin()