2👍
Have you looked at the code in the runserver part of manage.py that does the monitoring? I see no reason you could not just copy-paste that code into a custom manage.py script and set it to run the lighty restart command when changes were detected.
Alternatively, you could run a separate python program that did the restart using a package like pyinotify:
0👍
I’m wondering if anyone has ever gotten this to work? I have tried implementing a reload mechanism using django’s autoreload.py, unfortunately, I get errors when the fork occurs like:
django/core/servers/fastcgi.py”, line 180, in runfastcgi
WSGIServer(WSGIHandler(), **wsgi_opts).run()
File “build/bdist.freebsd-6.4-RELEASE-p9-amd64/egg/flup/server/fcgi_fork.py”, line 140, in run
File “build/bdist.freebsd-6.4-RELEASE-p9-amd64/egg/flup/server/preforkserver.py”, line 119, in run
File “build/bdist.freebsd-6.4-RELEASE-p9-amd64/egg/flup/server/preforkserver.py”, line 450, in _installSignalHandlers
ValueError: signal only works in main thread
My ideal setup would be to be able to reload/kill my fcgi process and start a new one after each time a code change is detected, similar to how django does this with their internal server. I also tried removing the threading from autoreload.py that would get past this error, but it does not seem to run the server properly (still investigating that).
Perhaps someone has tried CherryPies autoreload.py in the settings.py file for django?