Created
August 2, 2013 18:32
-
-
Save ipconfiger/6142227 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| __author__ = 'alexander' | |
| import os | |
| import sys | |
| from tornado.options import options, define, parse_command_line | |
| import django.core.handlers.wsgi | |
| import tornado.httpserver | |
| import tornado.ioloop | |
| import tornado.web | |
| import tornado.wsgi | |
| _HERE = os.path.dirname(os.path.abspath(__file__)) | |
| sys.path.append(_HERE) | |
| sys.path.append(os.path.join(_HERE, '..')) | |
| sys.path.append(os.path.join(_HERE, '../contrib')) | |
| os.environ['DJANGO_SETTINGS_MODULE'] = "settings" | |
| def main(port): | |
| wsgi_app = tornado.wsgi.WSGIContainer( | |
| django.core.handlers.wsgi.WSGIHandler()) | |
| tornado_app = tornado.web.Application( | |
| [('.*', tornado.web.FallbackHandler, dict(fallback=wsgi_app)), | |
| ]) | |
| server = tornado.httpserver.HTTPServer(tornado_app) | |
| server.listen(port) | |
| tornado.ioloop.IOLoop.instance().start() | |
| if __name__ == '__main__': | |
| main(int(sys.argv[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment