Django and Nginx

Django provides a Python-based web development framework. Nginx is a fast, light, and simultaneously very robust web server platform.

= Installing packages = Configure your use flags. (At this point I'm just copying my USE flags. Not sure if all these are required. Adjust to suit.)

Install relevant packages.

Set up project (content) directories.

= Configuration = Configure each site:

Configure Nginx to map Django sites on their listed ports.

= Django FastCGI Init = Provide Django FastCGI Startup Script:

Note that this runs fastcgi (and thus django) as the 'nginx' user. Feel free to change that. You'll need to chown the run folder for the pids:

Make the django-fcgi script executable:

Integrate configuration and startup scripts:

= Testing = Create a basic Django site for testing:

Start services:

At this point you should issue some queries against the listening Nginx configuration, and check /var/log/nginx/*_log for errors. If all is well, you'll see a message in your browser saying "It worked!", with additional notes from Django.

Then you get to configure your Django site.

= References =
 * Nginx
 * Django with Nginx on Debian
 * Django with Lighttpd on Gentoo
 * Original notes