Friday, March 19, 2010

Apache mod_fcgid is the way to go for webpy

1. automatically spawns more processes based on traffic - lighttpd automatically the spawns the max number of processes even when no traffic - which is not useful if your max-procs is 100


2. usually need to set PYTHONPATH or append to sys.path inside code.py manually
import os,sys
sys.path.append( os.path.dirname(os.path.abspath(__file__)))

3. This is how you hook app.run for webpy
if __name__ == '__main__':
if apache:
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
app.run(session_mw)
else:app.run(session_mw)