This directory contains an example of how to combine Twisted and Django using the latest WSGI functionality in twisted.web.
http://clemesha.org/blog/2009/apr/23/Django-on-Twisted-using-latest-twisted-web-wsgi/
Recommended: Use a
virtualenv
and install withpip
, to get them type:easy_install virtualenv pip
Create a fresh
virtualenv
:virtualenv --no-site-packages twisted_wsgi_django_env
Install dependencies into your
virtualenv
:#You must have Django 1.0+ and Twisted 9.0.0+ pip -E twisted_wsgi_django_env install twisted django
Get a copy of the example:
curl http://github.com/clemesha/twisted-wsgi-django/tarball/master #Or clone a copy: $ git clone git://github.com/clemesha/twisted-wsgi-django.git
Move into your
virtualenv
and activate it:$ cd twisted_wsgi_django_env $ source bin/activate
Move into the example and do a syncdb:
$ cd mydjangosite $ python manage.py syncdb #be sure to create an admin user
Move up one directory and run the example:
$ cd .. #assume you are in 'mydjangosite' $ twistd -ny server.py #open localhost:8000 in browser
If you decide to build an application with this server and deploy it, you can start the server as a daemon with:
$ twistd -y server.py #remember to change the port in server.py to choose an open port in your server.
All code licensed under the BSD. Contact: Alex Clemesha <[email protected]> | http://twitter.com/clemesha