Created
October 23, 2014 16:33
-
-
Save weargoggles/42edcb0f2bc31b9c8db7 to your computer and use it in GitHub Desktop.
Django/Tornado
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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