OK, I didn't know about the "attach-daemon" option.

Here is the python reload script I finally came up with:

#! /usr/bin/python

import pyinotify, sys, os, signal

def callback(evt):
    print "Change detected!", evt
    os.kill(os.getppid(), signal.SIGHUP)
    sys.exit(0)

wm = pyinotify.WatchManager()
notifier = pyinotify.Notifier(wm, default_proc_fun=callback)
root = sys.argv[1]
for parentdir, dirs, files in os.walk(root):
    for file in files:
        if file.endswith(".tmpl") or file.endswith(".py"):
            wm.add_watch(os.path.join(parentdir, file),
pyinotify.ALL_EVENTS)
notifier.loop()

And the uwsgi config:

{
    "uwsgi": {
        "attach-daemon": "uwsgi-watch-wc /path/to/my/app",
        "module": "server:application",
        "pythonpath": ["/path/to/my/app"],
        "uid": "www-data",
        "gid": "www-data"
    }
}

Thanks to all for your useful contributions!
-- 
Jean-Baptiste Quenot
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to