uwsgi py-autoreload 不被尊重
我有一个烧瓶应用程序。当我运行 wsgi.py Flask 在调试模式下运行并且我对任何视图文件所做的所有更改时,Flask 都会重新加载。当我跑步时:
“uwsgi --socket 0.0.0.0:5050 --protocol=http -w wsgi:app”
由于某种原因,uwsgi 没有告诉 Flask 重新加载,尽管我有
“py-autoreload = 1”
.ini 文件中设置的 选项。 uwsgi.ini和wsgi.py位于根目录中,init.py位于名为flask项目的子目录中,我在其中有我的观点。不知道我错过了什么。
_________________uwsgi.ini_________________
[uwsgi]
module = wsgi:app
master = true
processes = 5
buffer-size = 32768
http = 0.0.0.0:5000
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
chmod-socket = 660
vacuum = true
die-on-term = true
py-autoreload = 1
_________________wsgi.py_________________
from flask_project import create_app
app = create_app()
if __name__ == '__main__':
app.run(debug=True)
_________________flaskproject/__init__.py_________________
from flask import Flask
from werkzeug.debug import DebuggedApplication
def create_app():
app = Flask(__name__)
app.wsgi_app = DebuggedApplication(app.wsgi_app, True)
app.debug = True
return app
I have a flask app. When I run wsgi.py flask runs in debug mode and all changes I make to any of my view files, Flask reloads. When I run:
"uwsgi --socket 0.0.0.0:5050 --protocol=http -w wsgi:app"
For some reason uwsgi is not telling Flask to reload although I have the
"py-autoreload = 1"
option set in the .ini file. The uwsgi.ini and the wsgi.py are in the root dir and the init.py is in sub directory called flask project where I have my views. Not sure what I am missing.
_________________uwsgi.ini_________________
[uwsgi]
module = wsgi:app
master = true
processes = 5
buffer-size = 32768
http = 0.0.0.0:5000
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0
chmod-socket = 660
vacuum = true
die-on-term = true
py-autoreload = 1
_________________wsgi.py_________________
from flask_project import create_app
app = create_app()
if __name__ == '__main__':
app.run(debug=True)
_________________flaskproject/__init__.py_________________
from flask import Flask
from werkzeug.debug import DebuggedApplication
def create_app():
app = Flask(__name__)
app.wsgi_app = DebuggedApplication(app.wsgi_app, True)
app.debug = True
return app
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了。我没有直接调用 .ini 文件。我通过调用它
现在自动重新加载正在工作。
Figured it out. I was not calling the .ini file directly. I called it by
and now auto-reload is working.