Jun 132011

The website of the Django web framework can be found on https://www.djangoproject.com/.


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:

django-admin.py startproject django_bookmarks

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

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

Change file settings.py (to use sqlite3):

vi django_bookmarks/settings.py

and enter:

    ('Your Name', 'your.name@example.com')

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 manage.py syncdb
python manage.py createsuperuser

Create an application inside the project

This will create the application bookmarks:

python manage.py startapp app

Now you’ve got the directory “app” with the files init.py, views.py and models.py. You are ready now to create an HTML template:

cd django_bookmarks
mkdir templates

Adjust the URLs

Uncomment the following lines in django_bookmarks/urls.py:

from django.contrib import admin

    url(r'^admin/', include(admin.site.urls)),

No run (or rather debug) the project via

cd django_bookmarks
python manage.py 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:


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Related Posts:

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>