Skip to content

Instantly share code, notes, and snippets.

@gabamnml
Created January 30, 2012 13:10
Show Gist options
  • Save gabamnml/1704316 to your computer and use it in GitHub Desktop.
Save gabamnml/1704316 to your computer and use it in GitHub Desktop.
Django with Tornado
#! /usr/bin/env python
import os
import tornado.httpserver
import tornado.ioloop
import tornado.wsgi
import sys
import django.core.handlers.wsgi
sys.path.append('/your/project/path/')
def main():
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
application = django.core.handlers.wsgi.WSGIHandler()
container = tornado.wsgi.WSGIContainer(application)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen(8000)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment