[Twisted-Python] WSGI Question

Phil Christensen phil at bubblehouse.org
Wed Jan 20 10:37:48 EST 2010

On Jan 20, 2010, at 9:58 AM, adamjamesdrew same wrote:
> I deploy code. Then I modify the code on my file system. The code does not automatically change on the server. It does this on the django dev server. How can I make this happen?

This is a Django-specific feature that doesn't exist in Twisted.

It wouldn't be too hard to write, but it's the kind of feature that tends to be useful more to web developers than authors of other kinds of applications.

As it is, automatic code reloading is tricky to achieve in Python, since reload(modulename) only reloads modulename in the current scope, and must be reloaded everywhere that module is used.

It looks to me like Django's dev server gets around this by forking a child process before loading any external modules, and killing that child any time a reload is needed. Then the child is re-spawned, and since the parent has yet to load any external modules, any attempt to do so in the child causes the modules to be loaded for the first time (for that child).

Pretty clever, IMO...


More information about the Twisted-Python mailing list