【发布时间】:2017-03-06 16:45:38
【问题描述】:
aiohttp_utils gunicorn server 激活了reload 选项,在更新 .py 时不会完全重新启动开发服务器。
为了测试,我在myapp.py 文件的开头添加了一个print ("STARTING...")。
STARTING...
[2017-03-06 17:17:01 +0100] [5299] [INFO] Starting gunicorn 19.7.0
[2017-03-06 17:17:01 +0100] [5299] [INFO] Listening at: http://127.0.0.1:5002 (5299)
[2017-03-06 17:17:01 +0100] [5299] [INFO] Using worker: aiohttp_utils.runner.GunicornWorker
[2017-03-06 17:17:01 +0100] [5308] [INFO] Booting worker with pid: 5308
我更新并保存文件 myapp.py,然后我可以阅读:
[2017-03-06 17:17:47 +0100] [5308] [INFO] Worker reloading: /.../myapp.py modified
[2017-03-06 17:17:48 +0100] [5308] [INFO] Stopping server: 5308, connections: 0
[2017-03-06 17:17:48 +0100] [5308] [INFO] Worker exiting (pid: 5308)
[2017-03-06 17:17:48 +0100] [5339] [INFO] Booting worker with pid: 5339
应用程序未在浏览器上重新加载。
文件myapp.cpython-36.pyc 没有在__pycache__ 中更新,模块也没有重新运行,(没有“STARTING...”)
注意:__pycache__ 目录具有正确的用户权限。
我这样运行 myapp:
from aiohttp_utils import run
import myapp
run(app=myapp.app, app_uri='myapp:app', host='127.0.0.1', reload=True, port=5002)
【问题讨论】:
-
问题解决了吗?
标签: macos gunicorn python-3.6 aiohttp