簡體   English   中英

每當代碼更改發生時,在django應用程序中添加uswgi.reload()函數的位置以重新啟動服務器

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM