--- a/app/main.py Fri May 22 10:08:08 2009 +0200
+++ b/app/main.py Sun May 24 22:29:54 2009 +0200
@@ -29,42 +29,7 @@
from google.appengine.ext.webapp import util
-
-# Remove the standard version of Django.
-for k in [k for k in sys.modules if k.startswith('django')]:
- del sys.modules[k]
-
-# Force sys.path to have our own directory first, in case we want to import
-# from it. This lets us replace the built-in Django
-sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
-
-sys.path.insert(0, os.path.abspath('django.zip'))
-
-ultimate_sys_path = None
-
-# Force Django to reload its settings.
-from django.conf import settings
-settings._target = None
-
-# Must set this env var before importing any part of Django
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
-import django.core.handlers.wsgi
-import django.core.signals
-import django.db
-
-# Log errors.
-def log_exception(*args, **kwds):
- """Function used for logging exceptions.
- """
- logging.exception('Exception in request:')
-
-# Log all exceptions detected by Django.
-django.core.signals.got_request_exception.connect(log_exception)
-
-# Unregister the rollback event handler.
-django.core.signals.got_request_exception.disconnect(
- django.db._rollback_on_exception)
+import gae_django
def profile_main_as_html():
@@ -117,11 +82,7 @@
def real_main():
"""Main program without profiling.
"""
- global ultimate_sys_path
- if ultimate_sys_path is None:
- ultimate_sys_path = list(sys.path)
- else:
- sys.path[:] = ultimate_sys_path
+ import django.core.handlers.wsgi
# Create a Django application for WSGI.
application = django.core.handlers.wsgi.WSGIHandler()