Merge branch ultimate:plugins/yaml into community
[idea/community.git] / python / pluginTestResources / main.py
1 import os,sys
2 os.environ['DJANGO_SETTINGS_MODULE'] = '{0}.settings'
3
4 # Google App Engine imports.
5 from google.appengine.ext.webapp import util
6
7 # Force Django to reload its settings.
8 from django.conf import settings
9 settings._target = None
10
11 import django.core.handlers.wsgi
12 import django.core.signals
13 import django.db
14 import django.dispatch.dispatcher
15
16 # Log errors.
17 #django.dispatch.dispatcher.connect(
18 #   log_exception, django.core.signals.got_request_exception)
19
20 # Unregister the rollback event handler.
21 django.dispatch.dispatcher.disconnect(
22     django.db._rollback_on_exception,
23     django.core.signals.got_request_exception)
24
25 def main():
26   # Create a Django application for WSGI.
27   application = django.core.handlers.wsgi.WSGIHandler()
28
29   # Run the WSGI CGI handler with that application.
30   util.run_wsgi_app(application)
31
32 if __name__ == '__main__':
33   main()