Permalink
Browse files

Created a module to expose a WSGI app called application

  • Loading branch information...
1 parent 1434f6c commit 0bd9b4df7463b4987853beca3eee0ad1a328b5c1 @ericmoritz ericmoritz committed Nov 8, 2010
Showing with 19 additions and 0 deletions.
  1. +19 −0 django/app.py
View
@@ -0,0 +1,19 @@
+import site
+import os
+
+# Django is such a pain to get to work within WSGI
+here = os.path.dirname(os.path.abspath(__file__))
+there = os.path.join(here, "fml")
+site.addsitedir(here)
+site.addsitedir(there)
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+
+from django.core.handlers.wsgi import WSGIHandler
+
+application = WSGIHandler()
+
+if __name__ == '__main__':
+ from wsgiref.simple_server import make_server
+ httpd = make_server('', 9002, application)
+ print "Serving on port 8080..."
+ httpd.serve_forever()

0 comments on commit 0bd9b4d

Please sign in to comment.