Skip to content

Instantly share code, notes, and snippets.

@weargoggles
Created October 23, 2014 16:33
Show Gist options
  • Save weargoggles/42edcb0f2bc31b9c8db7 to your computer and use it in GitHub Desktop.
Save weargoggles/42edcb0f2bc31b9c8db7 to your computer and use it in GitHub Desktop.
Django/Tornado
import os
import tornado.httpserver
import tornado.ioloop
import tornado.wsgi
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
def main():
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 80))
application = Cling(get_wsgi_application())
container = tornado.wsgi.WSGIContainer(application)
http_server = tornado.httpserver.HTTPServer(container)
http_server.listen(port)
tornado.ioloop.IOLoop.instance().start()
from tornado import autoreload
autoreload.start()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment