-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.py
35 lines (24 loc) · 908 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import logging
import os
import sys
# Must set this env var before importing any part of Django
# 'project' is the name of the project created with django-admin.py
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
import django.core.signals
import django.db
import django.dispatch
# Force Django to reload its settings.
from django.conf import settings
from google.appengine.api import memcache
sys.modules['memcache'] = memcache
settings._target = None
def log_exception(*args, **kwds):
logging.exception('Exception in request:')
signal = django.dispatch.Signal()
# Log errors.
signal.connect(log_exception, django.core.signals.got_request_exception)
# Unregister the rollback event handler.
signal.disconnect(django.db._rollback_on_exception,
django.core.signals.got_request_exception)
application = django.core.handlers.wsgi.WSGIHandler()