简体   繁体   中英

Where to add uswgi.reload() function in django app to restart the server whenever code changes occur

I have a code snippet which i got from web to restart the uWsgi + Django stack, whenever code changes occur. But How to register and where to add this snippet or how to implement this in 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()

I am new to python and Django, so please forgive me if anything is wrong.

这个问题已经很老了,但是这个代码片段可以放在wsgi.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM