在更改django设置后,uwsgi不会重新加载 [英] uwsgi does not reload after changing django settings

查看:1670
本文介绍了在更改django设置后,uwsgi不会重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了uwsgi来服务于nginx后面的django。然后我在django设置中更改数据库,但uwsgi仍然显示具有旧数据库的站点。



我也尝试过这个建议,并添加了

  touch-reload = /etc/uwsgi/apps-available/django.ini 

到ini文件。但是在重新启动uwsgi并触摸 django.ini 之后,它仍然服务于旧站点。我试图停用并重新启动virtualenv,也没有机会。所以真的很困惑,欣赏你的提示。

解决方案

从uWSGI文档关于 touch-reload
如果指定的文件被修改/触摸,重新加载uWSGI
所以如果你想重新加载settings.py中的更改,你应该做:

  touch-reload = /path/to/your/django-project/settings.py 

您在uWSGI ini文件中的任何更改重新加载uWSGI之前使用的指令。


$ b $您需要在代码库中更改uWSGI,您可以使用py-autoreload指令:
http://uwsgi-docs.readthedocs.org/en/latest/Options.html#py-autoreload
所以你应该在你的uwsgi.ini

  py-autoreload = 1 

请注意,此选项不推荐用于生产。
祝你好运!


I have set up uwsgi to serve django behind nginx. Then I change the database in django settings but uwsgi still shows the site with old database.

I also tried this suggestion and added

touch-reload = /etc/uwsgi/apps-available/django.ini

to the ini file. But after restarting uwsgi and touching django.ini it still serves the old site. I tried to deactivate and reactivate virtualenv, no chance either. So really got confused and appreciate your hints.

解决方案

From uWSGI docs about touch-reload: reload uWSGI if the specified file is modified/touched So if you want to reload on changes in settings.py, you should do:

touch-reload = /path/to/your/django-project/settings.py

Directive you've used before reloads uWSGI on any changes in uWSGI ini file.

FYI, of you need to restart uWSGI on changes in codebase also, you can use py-autoreload directive: http://uwsgi-docs.readthedocs.org/en/latest/Options.html#py-autoreload So you should have something like this in your uwsgi.ini

py-autoreload = 1

Note, this options doesn't recommended for production. Good luck!

这篇关于在更改django设置后,uwsgi不会重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆