python - 部署后烧瓶的uWSGI-apscheduler问题,因为招摇页面抛出502错误
问题描述
在烧瓶中实现 apscheduler 时,我遇到了 uWSGI 的问题。我在 uwsgi.ini文件中添加了以下内容
[uwsgi]
module = main
callable = app
enable-threads = true
lazy-apps=true
要求.txt
werkzeug==0.16.1
Flask-SQLAlchemy==2.4.4
APScheduler==3.7.0
flask_apscheduler==1.12.2
flask==1.1.2
requests==2.24.0
在本地环境中运行时,这工作正常。但是在部署时,我收到以下错误,并且与之相关的招摇页面会引发 502 错误
raise RuntimeError('The scheduler seems to be running under uWSGI,but threads have been disabled.You must run uWSGI with the --enable--threads..
unable to load app 0 (mount point='') callable not found or import error
***no app loaded. GAME OVER***
在main.py中,我这样编码
default_config = create_default_config()
app = create_app(default_config) # pylint: disable=invalid-name
CORS(app)
job_test = job() #internal coding
scheduler = JobScheduler(2)
# scheduler.add_job_queue(demo_job)
scheduler.add_job_queue(job_test)
scheduler.start()
if __name__ == "__main__":
app.run()
解决方案
推荐阅读
- python-3.x - 如何打印表格(见图)
- c# - 如何在 EF Core 3.1 中使用 Linq 表达式与 GroupBy 的多个表进行完全联接
- android - 由同一开发人员在 Android 应用程序之间共享数据
- pine-script - Pine 脚本指示器问题(可能代码已过时)
- apache-spark - 将 csv 文本的数据框列分解为列
- python - 在 python 中使用 3D 数组填充 2D 数组
- .net-core - Asp.net 核心 & Tailwind css
- android - 使用重新训练的 Tensorflow 对象检测模型使用 snpe 进行 pb 到 dlc 转换失败
- mysql - mysql连接sleep太多,wait_timeout不起作用
- google-app-engine - 在原生模式下在 AppEngine + Firestore 中创建复合索引