-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
40 lines (31 loc) · 1.01 KB
/
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
35
36
37
38
39
40
# __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
"""
This is the equivalent of <site>/djangoWsgi.py but for use under Google App Engine.
"""
import os
import sys
import django
from django.core.handlers import wsgi
from django.core import management
from google.appengine.ext.webapp import util
_up = os.path.dirname
thisDir = _up(_up(_up(os.path.realpath(__file__))))
settings_path = 'settings'
os.environ['DJANGO_SETTINGS_MODULE'] = settings_path
os.environ['DJANGO_SCRIPT_NAME'] = '/'
sys.path.insert(0, os.path.join(thisDir, 'apps'))
sys.path.insert(0, os.path.join(thisDir, 'submodules', 'geocamAppEngineLibs'))
try:
settings = __import__('settings')
management.setup_environ(settings, original_settings_path=settings_path)
except ImportError:
pass
app = wsgi.WSGIHandler()
def main():
util.run_wsgi_app(app)
if __name__ == '__main__':
main()