On Mar 21, 10:53 am, Graham Dumpleton <[email protected]>
wrote:
> blah blah blah <snip>
> This is about as good as you are going
> to get with Python. This isn't PHP where the application is thrown
> away at the end of every request.
Yadda yadda yadda, wrong, it _is_ like PHP where the application is
thrown away after every request. Enjoy:
!/usr/bin/env python
import os, sys, signal
import traceback
here = os.path.dirname(__file__)
if here not in sys.path:
sys.path.insert(0, here)
try:
from webwork import Application, ConfigParser
from lib import handlers, Database
config_path = os.path.join(here, 'app.cfg')
config = ConfigParser(config_path)
db_url = config.get('db', 'url')
db = Database(db_url)
app = Application(handlers, db, config)
def application(environ, start_response):
if config.getboolean('debug', 'debug'):
os.kill(os.getpid(), signal.SIGINT)
return app(environ, start_response)
except:
data = traceback.format_exc()
def appliaction(environ, start_response):
os.kill(os.getpid(), signal.SIGINT)
start_response('500 SERVER ERROR', [
('Content-Type', 'text/plain'),
])
return [data]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---