def get_free_signal(): if not uwsgi: return None for signum in range(0, 256): if not uwsgi.signal_registered(signum): return signum raise Exception('No free uwsgi signal available')
def __init__(self, path): try: import os import uwsgi signal = [signum for signum in range(0,256) if not uwsgi.signal_registered(signum)][0] uwsgi.register_signal(signal, '', uwsgi.reload) for path in [x[0] for x in os.walk(path)]: uwsgi.add_file_monitor(signal, path.decode(encoding='UTF-8')) except Exception as err: pass # Not running under uwsgi. The other supported alternative is gunicorn.
def signal_registered(self): ''' ''' return uwsgi.signal_registered()