Earlier this afternoon I committed an auto-reload feature to Webware CVS. I'd like to credit Tavis Rudd, who provided the initial implementation for this feature. Here are the details:
Overview -------- The purpose of this feature is to make life easier on the developer by having the appserver notice when you make modifications to source files and restart itself to pick up these changes. Details ------- Source files which are monitored include all *.py files loaded by the application server, which includes servlets, __init__.py files in package directories, and the Webware sources themselves. The monitor knows about PSPs and Cheetah templates, and will monitor the source file corresponding to the generated servlet or template file, which is what you want. Note: I've only tested PSPs; please let me know if Cheetah templates also work as expected. The server will also monitor files which could not be successfully imported. For example, say you write MyPage.py which contains a syntax error, and then try to request the page. Because of the syntax error the module cannot be imported, which will give you a traceback. But after error and save the file, the appserver will restart itself to pick up the change. If you install python-fam (http://python-fam.sf.net) and have a libfam/famd (file alteration monitor) installed on your machine, this will be used, which is much more efficient. Otherwise the appserver will poll the files at regular intervals for changes. The method of monitoring (FAM or polling) is printed by the server at startup. The server is restarted using exec, which causes the existing process to be replaced. This means that it will work regardless of how you have your permissions set up and under what user the appserver executes in your environment. It will be called with the same command line arguments as the original invocation.* The process keeps the same process id (PID), too. * Well, actually occurrences of "restart" are replaced by "start". Since the server shuts itself down before starting itself again, this is what you want. Configuration ------------- Autoreload is disabled by default. To enable it include the line 'AutoReload': 1, in your AppServer.config file. If you wish to customize the polling interval, you can also set: 'AutoReloadPollInterval': 5, to check files every 5 seconds. The default is to check every 1 second. Please let me know of any problems. -- Jason D. Hildebrand [EMAIL PROTECTED] ------------------------------------------------------- This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0003en _______________________________________________ Webware-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-devel