Setup Django Testproject

Setup a Django test project in the CSIE ~/ (home) Directory (without root access)

1. Ensure Python 2.5 is in the PATH (python 2.5 includes sqlite3 and pysqlite)

1.1 Set PATH

b96123@linux11 [~/bin] vi ~/.shrc

add the following export:

# Ensure python 2.5 is used (pysqlite and sqlite3)
export PATH=/home/student/96/b96123/bin:$PATH

1.2 Create symlink (so that python2.5 is used)

b96123@linux11 [~/] cd ~
b96123@linux11 [~/] mkdir bin
b96123@linux11 [~/] ln -s /usr/bin/python2.5 bin/python

1.3 Source the script

b96123@linux11 [~/] . ~/.shrc

2. Install Django

Good tutorial:

Setup a Django test project (aka hello world web application) on Windows

1. Install Python 2.5

Note: Don't forget to set the PATH environment variable

1.0: Download it from:
1.1: Install it
1.2: Update PATH settings: System -> Advanced -> Environment Settings
1.3: Update the system PATH variable

Put the following information


in front of the existing PATH environment variable.

2. Install pysqlite

Note: Download the appropriate release from:

Example (for Python 2.5):

3. Download the DJango Tarball

Direct Download Link:

4. Untar the tarball and install django

Preliminary check:

$ which python

C:\apps>which python

If /usr/lib/python is used check your environment settings and don't continue!

$ mkdir c:\apps
$ cd c:\apps
$ cp [DOWNLOAD_FOLDER]/Django-0.96.1.tar.gz . 
$ tar xzvf Django-0.96.1.tar.gz
$ cd Django-0.96.1
$ python install

Note: If you don't have the tar utility on your system install cygwin Direct Download:

Note 2: You can open the tarball with WinZip though (…but cygwin will be useful anyway
sooner or later)

Note 3: Path when using cygwin:
Ex: /cygdrive/c/apps/django/Django-0.96.1$ python install

5. Check if installation was successful

Where are we?

You should be in the directory: C:\apps\django\Django-0.96.1>

Create a test project

$ startproject testproject
$ cd testproject
$ python runserver

Browse to http://localhost:8000 and you should see a message like:

It worked!
Congratulations on your first Django-powered page.

6. Configure database settings

Note: If you are interested in details, check out ->

It's time to edit the database settings (we are using the sqlite db). Edit
Change the following settings:

Open new shell (cmd.exe or cygwin)

$ cd C:\apps\django\Django-0.96.1\testproject
$ notepad
DATABASE_ENGINE = 'sqlite3'           # ...
DATABASE_NAME = 'testdb.db'         # ...

Sync the database (creates the database tables)

"The syncdb command looks at the INSTALLED_APPS setting and creates any necessary
database tables according to the database settings in your file."
- Source:

$ python syncdb


Creating table auth_message
Creating table auth_groups
Creating table auth_user
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username: admin

7. Environment setup is completed - Congratulations! :)

8. Setup your first 'hello world' web application

Follow the instructions @
Section: Creating models

Note: the sample project in the tutorial is called mysite, whereas our project is called testproject.
!!! make sure that you replace mysite with testproject whenever you edit any configuration files !!!

Note 2: It's important that you use the 0.96 tutorial since we use the 0.96 release and
not the development release. For example the model field class attribute maxlength is used
in 0.96 (what we are using) but is called max_length in the current development release.
So if you encounter an error like:

TypeError: init() got an unexpected keyword argument 'max_length'
after executing: C:\apps\django\Django-0.96.1\testproject>python sql polls

you might read the wrong tutorial.

Misc Stuff

to be done later..

Step X. Install Subversion

tortoise svn

Other tutorials

Install Django on Win32

Django Djumpstart: Build a To-do List in 30 Minutes

Build to do list in 30 minutes

Writing your first Django App

Misc Info

Builtin Web Server

Django development server, a lightweight Web server written purely in
Python. We’ve included this with Django so you can develop things rapidly,
without having to deal with configuring a production server
— such as Apache — until you’re ready for production.


./ runserver
What this does is runs the server attaching to the IP address of
your machine rather than This allows you to go to another
computer on your network and enter the IP address of your machine as the URL
(eg: and pull up the site.
This is great if you're developing on a Mac, say, and want to test in IE6 or IE7.

FastCGI, SCGI, and Apache: Background and Future

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License