An example how to run Django on Tornado. Simply run
run_tornado.py and navigate your browser to
to see an HTTP-response from Django, respectively Tornado.
You don't have to change anything to run this with your own Django project, but this line in
os.environ['DJANGO_SETTINGS_MODULE'] = 'demosite.settings' # TODO: edit this
DJANGO_SETTINGS_MODULE should point to your
settings.py in your Django project.
To hook up Tornado handlers, use the common workflow:
tornado_app = tornado.web.Application( [ ('/hello-tornado', HelloHandler), ('.*', tornado.web.FallbackHandler, dict(fallback=container)), ])
Notice that in this example, all requests but
/hello-tornado will be redirected to Django.
You'll obviously need the django and tornado Python-modules to run this demo ;-) You can install them quickly using
pip and the provided
requirements.txt. I recommend creating a virtual environment for every project you're working on.
pip install -r requirements.txt
Or install them manually:
pip install django pip install tornado