Setting up a django website calls for (though not always):

  • django installation
  • configuring Apache
  • mod_wsgi
  • others like database servers, static file server etc

Now if you are developing a small scale website, you may not want to go the Apache, mod_wsgi way.. Django helps here by providing a development web server, so that you can get your website up and running rapidly.

This blog talks about setting django website on Ubuntu 10.04:

Step1: Get python-pip

buntu@ubuntu:~$ sudo apt-get install python-pip 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libtext-glob-perl libcompress-bzip2-perl libparams-util-perl libfile-chmod-perl libdata-compare-perl libfile-pushd-perl libfile-which-perl
  libcpan-inject-perl libfile-find-rule-perl libcpan-checksums-perl libnumber-compare-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
The following NEW packages will be installed:
  python-pip python-setuptools
0 upgraded, 2 newly installed, 0 to remove and 186 not upgraded.
Need to get 262kB of archives.
After this operation, 1,192kB of additional disk space will be used.
Do you want to continue [Y/n]? 
Get:1 lucid/main python-setuptools 0.6.10-4ubuntu1 [213kB]
Get:2 lucid-updates/universe python-pip 0.3.1-1ubuntu2.1 [49.8kB]
Fetched 262kB in 5s (50.6kB/s)      
Selecting previously deselected package python-setuptools.
(Reading database ... 124327 files and directories currently installed.)
Unpacking python-setuptools (from .../python-setuptools_0.6.10-4ubuntu1_all.deb) ...
Selecting previously deselected package python-pip.
Unpacking python-pip (from .../python-pip_0.3.1-1ubuntu2.1_all.deb) ...
Processing triggers for man-db ...
Setting up python-setuptools (0.6.10-4ubuntu1) ...

Processing triggers for python-central ...
Setting up python-pip (0.3.1-1ubuntu2.1) ...

Step 2: Install django

buntu@ubuntu:~$ sudo pip install django
Downloading/unpacking django
  Downloading Django-1.4.1.tar.gz (7.7Mb): 7.7Mb downloaded
  Running egg_info for package django
Installing collected packages: django
  Running install for django
    changing mode of build/scripts-2.6/ from 644 to 755
    changing mode of /usr/local/bin/ to 755
Successfully installed django

Step 3: Check for django installation

buntu@ubuntu:~$ python -c "import django; print(django.get_version())"

Step 4: Create a project site

buntu@ubuntu:~$ startproject mysite
buntu@ubuntu:~$ tree mysite
`-- mysite

1 directory, 5 files

Step 5: Start django development server

buntu@ubuntu:~$ cd mysite
buntu@ubuntu:~/mysite$ python runserver
Validating models...

0 errors found
Django version 1.4.1, using settings 'mysite.settings'
Development server is running at
Quit the server with CONTROL-C.

Step 6: Browse to home page

[09/Oct/2012 01:42:52] "GET / HTTP/1.1" 200 1957