首页 > 解决方案 > 部署后烧瓶的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()

标签: pythonflaskuwsgiapscheduler

解决方案


推荐阅读