2. Install Django

Let’s install Django! We’ll use version 1.8 in this tutorial. Newer releases should work as well, but if you are in doubt, use 1.8:

$ pip install --upgrade Django==1.8.2


Under Linux and Mac OS X root privileges may be required. In this case use:

$ sudo pip install --upgrade Django==1.8.2


If you want to isolate the Python packages from the system site directories you have two options:

  1. Install the package(s) into a directory in your home directory using:

    $ pip install --user <packagename>
  2. Use a virtual environment for your project. One way to create a virtual environment is to install virtualenv. If you are using Python 3 you can also use the new venv module.

If you go for one of the options you can use it any time this tutorial asks you to run pip install.

After a successful installation, you can check the Django version number with the following command:

$ django-admin.py --version


It could be that the file django_admin.py is actually called django-admin. That’s not a problem, just leave off the extension .py.

On Windows you may get an ImportError when you try to run django-admin.py. Prefix all commands that use .py files with python and use the full path to the file, like so:

> python C:\Python27\Scripts\django-admin.py

2.1. Install extra packages for this tutorial

We will use Bootstrap 3 to get the frontend done quickly. Since Bootstrap expects a certain markup structure, we will use the excellent django-crispy-forms package to get our forms rendered nicely.

Starting with version 1.4, Django supports Timezones. This is activated by default and it is highly recommended to install the pytz package.

To install both packages execute:

$ pip install pytz django-crispy-forms


Under Linux and Mac OS X root privileges may be required.