bgolub / fftogo

Mobile FriendFeed Client

This URL has Read+Write access

Benjamin Golub (author)
Thu Feb 26 10:28:06 -0800 2009
fftogo / main.py
100644 38 lines (28 sloc) 1.084 kb
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
import logging
import os
import sys
 
# Remove the standard version of Django.
for k in [k for k in sys.modules if k.startswith('django')]:
    del sys.modules[k]
 
# Import Django from a zipfile if we don't have it on our path.
if "django" not in os.listdir(os.path.abspath(os.path.dirname(__file__))):
    sys.path.insert(0, os.path.abspath('django.zip'))
 
# Force sys.path to have our own directory first, in case we want to import
# from it.
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
 
# Google App Engine imports.
from google.appengine.ext.webapp import util
 
# Custom Django configuration.
from django.conf import settings
settings._target = None
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
 
# Import the part of Django we need.
import django.core.handlers.wsgi
 
def main():
    logging.getLogger().setLevel(logging.ERROR)
    # Create a Django application for WSGI.
    application = django.core.handlers.wsgi.WSGIHandler()
    # Run the WSGI CGI handler with that application.
    util.run_wsgi_app(application)
 
 
if __name__ == '__main__':
    main()