![](/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.