RuntimeError: The scheduler seems to be running under uWSGI, but threads have been disabled. You must run uWSGI with the --enable-threads option for the scheduler to work报错

发布时间 2023-11-13 02:53:51作者: __username

解释

RuntimeError: The scheduler seems to be running under uWSGI, but threads have been disabled. You must run uWSGI with the --enable-threads option for the scheduler to work,
白话:uWSGI调度器正在运行,但线程已被禁用

解决

uwsgi.ini里面添加:

http-timeout = 86400
enable-threads = true

总的uwsgi.ini配置如下:

[uwsgi]
#项目路径
chdir = /home/ubuntu/code/python/python_person/flask+vue2/flask-vue2
#虚拟环境环境路径
virtualenv = /home/ubuntu/code/python/python_person/flask+vue2/flask-vue2/.venv
#保存主进程的进程号
pidfile = uwsgi.pid
#指的后台启动 日志输出的地方
daemonize = uwsgi.log
http = 0.0.0.0:5000
#[方式一]wsgi文件 run就是flask启动文件去掉后缀名 app是run.py里面的Flask对象 
module = app:app
#指定工作进程
processes = 4
#主进程
master = true

# 当一个请求花费的时间超过这个时间,那么这个请求都会被丢弃。
harakiri = 60

# 新加
http-timeout = 86400
enable-threads = true

# 方式二
#wsgi-file = run.py
#callable = app