adding index.jsp fix
[botlist.git] / botlist_trinity / projects / ghostnet / main.py
blob0375e3f108bc706becfe1bbd085cea0cf47fe650
1 #!/usr/bin/env python
3 # Copyright 2008 Berlin Brown - botnode.com.
5 import os
6 import sys
7 import logging
9 # Google App Engine imports.
10 from google.appengine.ext.webapp import util
12 # A workaround to fix the partial initialization of Django before we are ready
13 from django.conf import settings
14 settings._target = None
16 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
18 # Import various parts of Django.
19 import django.core.handlers.wsgi
20 import django.core.signals
21 import django.dispatch.dispatcher
22 import django.db
24 def log_exception(*args, **kwds):
25 """Log the current exception.
26 Invoked when a Django request raises an exception"""
27 logging.exception("Exception in request:")
29 # Log errors
30 django.dispatch.dispatcher.connect(
31 log_exception,
32 django.core.signals.got_request_exception)
34 # Unregister the rollback event handler
35 django.dispatch.dispatcher.disconnect(
36 django.db._rollback_on_exception,
37 django.core.signals.got_request_exception)
39 def main():
40 # Create a Django application for WSGI.
41 application = django.core.handlers.wsgi.WSGIHandler()
43 # Run the WSGI CGI handler with that application.
44 util.run_wsgi_app(application)
47 if __name__ == '__main__':
48 main()