Hosting Django under Nginx with SCGI and WSGI
Description of mod_wsgi and mod_scgi currently developed for Nginx server.
- Get the latest code (mercurial RCS):
hg clone http://hg.mperillo.ath.cx/nginx/mod_wsgi/
- Compile nginx adding --add-module=/ścieżka/do/mod_wsgi/ to configure, for example:
- After compile and install you are ready to go.
SCGImod_scgi is a second module from the same developer, also in development. It does not handle full SCGI specs, so using it to host Django is currently a bit limited. Installation is very similar to the mod_wsgi install. Config looks like this: Most important is scgi_pass 127.0.0.1:8080; - on that IP/Port a WSGI/SCGI server has to listen. For django we have django-scgi.py, which we be run like this:
python django-scgi.py --projects=/path/to/Django/project/ --settings=settings --host=localhost --port=8080Django will return the page from the Django project, but it will look like text/plain and not as text/html:
Currently mod_scgi needs first line to look like:
Status: 200 OK Vary: Cookie Content-Type: text/html; charset=utf-8
HTTP/1.1 200 OKSo to use it some flup editing is required I guess ;)