【问题标题】:aiohttp_utils: gunicorn doesn't fully reload and doesn't rebuild pyc filesaiohttp_utils:gunicorn 没有完全重新加载,也没有重建 pyc 文件
【发布时间】: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


【解决方案1】:

尝试使用更新后的aiohttp-devtools 包进行自动重新加载,而不是aiohttp_utils

【讨论】:

    猜你喜欢
    • 2015-08-28
    • 2018-03-29
    • 1970-01-01
    • 1970-01-01
    • 2014-02-02
    • 2017-07-20
    • 2021-05-24
    • 2012-05-19
    • 2019-01-12
    相关资源
    最近更新 更多