Ubuntu Server Setup Guide for Django Websites

This guide is a walk-through on how to setup Ubuntu Server for hosting Django websites. The Django stack that will be used in this guide is Ubuntu, Nginx, Gunicorn and Postgres. This stack was chosen solely from the reading I’ve done and talking to other Django developers in order to get their recommendations. This stack seems to be one of the latest “standard” stacks for Django deployment. This guide also assumes that you’re familiar with Ubuntu server administration and Django. I needed an example site for this guide so I chose to use my Django Base Site which is available on Github.

How to create a self-signed SSL Certificate

…  which can be used for testing purposes or internal usage

.. Step 1: Generate a Private Key

.. Step 2: Generate a CSR (Certificate Signing Request)

.. Step 3: Remove Passphrase from Key

.. Step 4: Generating a Self-Signed Certificate

.. Step 5: Installing the Private Key and Certificate

.. Step 6: Configuring SSL Enabled Virtual Hosts

..  Step 7: Restart Apache and Test

How to use Fabric in a development environment

Fabric is a Python (2.5 or higher) library and command-line tool for streamlining
the use of SSH for application deployment or systems administration tasks.

.. Instead of running something like pip install MyApp and getting whatever libraries
come along, you can create a requirements file that includes all dependencies.

Example of a requirements.txt file
BeautifulSoup==3.2.0
python-dateutil==1.4.1
django==1.3.0
django-debug-toolbar==0.8.5
django-tagging==0.3
Markdown==2.0.1