pip install -r requirements.txt
进入config
目录,在该目录下打开config.y
文件,修改项目所要的配置文件
# 配置数据库
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://用户名:密码@localhost/数据库?charset=utf8'
# 设置token过期时间
EXPIRATION = 60 * 60 * 2
- python run.py
# 安装 gunicorn
pip install gunicorn
# 运行下面命令
nohup gunicorn -w 4 -b 0.0.0.0:5000 run:app &
该token
需要放置在headers
中,其它方式不可以,下面图片为使用postman
测试时token
的携带, 格式为
{
"Authorization": "Bearer token(将获取到的token进行替换, Bearer为固定字段,注意二者之间需要空格)"
}