Philipp Klaus's Computing Blog

Success is about speed and efficiency

The Django Web Framework

The website of the Django web framework can be found on


The current version of Django (2011-06-13: v1.3) can be installed on Ubuntu/Debian using

sudo apt-get install python-setuptools
sudo easy_install django

(The install-dir on Ubuntu 11.04 will be /usr/local/lib/python2.7/dist-packages. More on the install-dir can be read in a blog post by jeremy.)

An outdated version of Django can be found in the Ubuntu and Debian package management:

sudo apt-get install python-django

check version:

$ python
>>> import django
>>> django.VERSION
(1, 0, 'final')

Create a Django Project

Start a Project

In general: startproject django_bookmarks

If you installed Django via the Ubuntu/Debian package the command above should read django-admin .

Set your Settings: set up admin-user, enable the admin module and specify a database

Change file (to use sqlite3):

vi django_bookmarks/

and enter:

    ('Your Name', '')

DATABASE_NAME = 'bookmarksdb'

TIME_ZONE = 'Europe/Berlin'


Now you are able to create the database and create the basic tables for django:

cd django_bookmarks
python syncdb
python createsuperuser

Create an application inside the project

This will create the application bookmarks:

python startapp app

Now you've got the directory "app" with the files, and You are ready now to create an HTML template:

cd django_bookmarks
mkdir templates

Adjust the URLs

Uncomment the following lines in django_bookmarks/

from django.contrib import admin

    url(r'^admin/', include(,

No run (or rather debug) the project via

cd django_bookmarks
python runserver

You can then go to http://localhost:8000/ and http://localhost:8000/admin to see the result.

This was your first start into Django. The next steps are to add some models and views (including their URLs and templates). See these posts for more information: