【发布时间】:2015-05-09 16:15:23
【问题描述】:
我在生产服务器上使用 django 1.8 + uwsgi + nginx。 uwsgi 处于帝王模式。我在 myapp/settings.py 中导入了 uwsgi python 模块,以便在修改代码时启用自动重载。据我了解,此 python 模块仅在 python 线程由 uwsgi worker 生成时才可用于导入。当我尝试手动使用manage.py collectstatic时,是导入settings.py然后导入uwsgi.py失败。
有没有办法在使用 uwsgi python 模块的同时仍然能够使用 manage.py ?
我用来启用自动重载的代码(在 myapp/sttings.py 中):
import uwsgi
from uwsgidecorators import timer
from django.utils import autoreload
@timer(3)
def change_code_gracefull_reload(sig):
if autoreload.code_changed():
uwsgi.reload()
【问题讨论】:
-
哈哈,我知道这是从哪里来的。信用到期!!! projects.unbit.it/uwsgi/wiki/…
标签: python django uwsgi manage.py