![](/img/trans.png)
[英]Django views.py code running automatically whenever I reload the server
[英]Where to add uswgi.reload() function in django app to restart the server whenever code changes occur
每当网络发生代码更改时,我都会从网上获得一个代码段以重新启动uWsgi + Django堆栈。 但是如何注册以及在何处添加此代码段或如何在Django中实现。
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()
我是python和Django的新手,所以如果有任何错误,请原谅我。
这个问题已经很老了,但是这个代码片段可以放在wsgi.py
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.