繁体   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