烧瓶应用程序 - 本地开发环境 - 变化不反映
我有一个在本地运行和测试的烧瓶应用程序。每次我对应用程序代码进行更改,更改都会反映Dev环境http://127.0.0.1:8000/
使用简单的浏览器刷新。
现在,我必须终止烧瓶应用ctrl x
+ ctrl c
,然后重新启动/重新启动应用程序。我正在使用Gunicorn
启动烧瓶应用程序。
不确定发生了什么变化,但是如何配置该应用程序以使更改对刷新产生影响?
我在init.py
中有以下代码行:
if __name__ == '__main__':
run_simple('0.0.0.0', 80, app, use_reloader=True, use_debugger=True)
I have a Flask App that I am running locally and testing. Every time, I make a change in the Application code, the changes would reflect on the dev environment http://127.0.0.1:8000/
with a simple browser refresh.
Now, I have to terminate the Flask App Ctrl X
+ Ctrl C
and then reboot / relaunch the App. I am using gunicorn
to launch the Flask App.
Not sure what changed, but how do I configure the App such that the changes take effect on refresh?
I have the following line of code in init.py
:
if __name__ == '__main__':
run_simple('0.0.0.0', 80, app, use_reloader=True, use_debugger=True)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当应用程序代码更改时,Gunicorn拥有自己的系统来重新加载工作流程。您可以使用
- reload
cli> cli flag激活自动加载开发模式。
您可以通过
- reload-extra-file文件
arg。Gunicorn has its own system to reload the worker process when the application code changes. You can use the
--reload
CLI flag to activate the auto-reloading dev mode.You can add additional files to the watcher via the
--reload-extra-file FILES
arg.尝试使用枪支
也
Try
Also using Gunicorn