Hosting Django under Nginx with SCGI and WSGI
- 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:
./configure --add-module=/ścieżka/do/mod_wsgi/
- After compile and install you are ready to go.
SCGI
mod_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=8080
Django will return the page from the Django project, but it will look like text/plain and not as text/html:
Status: 200 OK Vary: Cookie Content-Type: text/html; charset=utf-8
HTTP/1.1 200 OK
So to use it some flup editing is required I guess ;)
RkBlog