在更改django设置后,uwsgi不会重新加载

编程入门 行业动态 更新时间:2024-10-11 19:19:03
本文介绍了在更改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指令: uwsgi-docs.readthedocs/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: uwsgi-docs.readthedocs/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不会重新加载

本文发布于:2023-11-13 11:06:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584192.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   django   uwsgi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!