Running pinax on tornado webserver, http://www.tornadoweb.org/ turns out to be quite easy to do.
$ wget http://www.tornadoweb.org/static/tornado-0.2.tar.gz
$ tar xvzf tornado-0.2.tar.gz
$ source /path/to/my/env/bin/activate
(env)$ cd tornado-0.2
(env)$ python setup.py build
(env)$ python setup.py install
You now have the tornado module in your virtualenv.
(env):~/tornado-0.2$ cp demos/django/testwsgi.py /to/my/project/dir/
Now, go to your project directory, the one with your settings.py and now testwsgi.py. Edit testwsgi.py:
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... (you should probably leave the license in your file?
import settings
import sys
from os.path import join
sys.path.insert(0, join(settings.PINAX_ROOT, "apps"))
sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
import django.core.handlers.wsgi
import os
import tornado.httpserver
import tornado.ioloop
import tornado.wsgi
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(8888)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()
Now, you can run:
(env):~/path/to/my/project$ python testwsgi.py
Open your browser to http://127.0.0.1:8888 and voila? So, how are we going to deploy this and what are we going to do with it?