Ian Bicking: the old part of his blog

What can wsgikit do for you comment 000

WSGIKit looks through all the modules in sys.modules and restarts the entire server if one of them changes. It is not initiated by a request, but rather runs in a separate thread and polls the files regularly. You can also make it look at extra files, like a configuration file, and restart when those change too. It doesn't reload modules, which is much more challenging to do correctly, though at some point I'll probably have it look at modules and see if some are explicitly marked to be reloadable. E.g., Webware servlet files (but not the files they import) can generally be reloaded.
Comment on Re: What can WSGIKit do for you?
by Ian Bicking


Yeah, restarting is the easy way out. No shame in taking the easy way sometimes! That is what Spyce has to do for anything it doesn't compile itself.
# Jonathan Ellis

BTW, to accomodate pathnames with spaces in them (common on Windows) you may want your reloader code to do something like this

args = ['"' + re.sub('"', r'"', i) + '"' for i in args]

before spawning the subprocess.

I also like to run python -u (if the speed hit matters they shouldn't have the modules checker turned on).

# Jonathan Ellis

eh, your wiki nuked the backslash in that sub() call.
# Jonathan Ellis

What happens if you use literal block text, like so:


Yep. Seems to work.

# Chad Walstrom