Flask Gunicorn不应用我的新代码更改

时间:2018-11-19 18:45:53

标签: python-3.x flask gunicorn

我正在开发Flask Web应用程序,在开发过程中,我使用run.py测试了我的应用程序。

run.py:

from my_app import app
from my_app.config import (WEBSERVER_PORT)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=WEBSERVER_PORT, debug=True)

但是,我计划在生产中使用Gunicorn服务我的应用程序,当我使用Gunicorn运行该应用程序时,我发现其性能有所下降。例如,我在Web应用程序中添加了一个新按钮,并且只有在使用run.py来运行该应用程序时,才能看到该新按钮。但是,当我使用gunicorn这样的应用来投放我的应用程序时:

gunicorn --bind 0.0.0.0:8000 wsgi

该应用程序运行没有错误,但是,我没有看到新按钮。这是我的wsgi.py:

from my_app import app as application

if __name__ == "__main__":
    application.run()

这是我的服务方式:

(venv)# gunicorn --bind 0.0.0.0:8000 wsgi
[2018-11-19 10:35:52 -0800] [16644] [INFO] Starting gunicorn 19.9.0
[2018-11-19 10:35:52 -0800] [16644] [INFO] Listening at: http://0.0.0.0:8000 (16644)
[2018-11-19 10:35:52 -0800] [16644] [INFO] Using worker: sync
[2018-11-19 10:35:52 -0800] [16647] [INFO] Booting worker with pid: 16647

所以我的问题是,Gunicorn是否会缓存您所做的任何更改,因为与Gunicorn一起使用时,我只会看到我的旧代码。还是在使用Gunicorn运行它之前我需要做些什么来获得新的更改?

0 个答案:

没有答案
相关问题