Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Django Mod_Wsgi - auto reload

I am trying to auto reload my django app which uses apache + mod_wsgi on my local windows machine.

I'd like to know where do I add this code that's referenced in the following article:

http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

def _restart(path):
    _queue.put(True)
    prefix = 'monitor (pid=%d):' % os.getpid()
    print >> sys.stderr, '%s Change detected to \'%s\'.' % (prefix, path)
    print >> sys.stderr, '%s Triggering Apache restart.' % prefix
    import ctypes
    ctypes.windll.libhttpd.ap_signal_parent(1)
like image 722
Eeyore Avatar asked Jul 07 '09 17:07

Eeyore


1 Answers

Read:

http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html

It tells you exactly where to place the file when using Django. You just need to make the code change that everyone is pointing out to you in the source code reloading documentation section related to Windows. Also read:

http://blog.dscpl.com.au/2009/02/source-code-reloading-with-modwsgi-on.html

which explains the variations on the first related to Windows.

like image 76
Graham Dumpleton Avatar answered Sep 28 '22 00:09

Graham Dumpleton