Before we install Django to start our first project we create a new virtualenv:
$ mkvirtualenv django-workshop
If virtualenvwrapper is not installed on your system you have to run virtualenv instead:
$ virtualenv .virtualenvs/django-workshop
Note
The command mkvirtualenv activates the virtualenv automatically after it’s created. If you used virtualenv to create the virtualenv you to activate it manually:
$ cd .virtualenvs/django-workshop
$ . bin/activate
Alright, let’s install Django:
$ pip install Django
Note
Under Linux and Mac OS X root privileges may be required.
After a successful installation, you can check the Django version number with the following command:
$ django-admin.py --version
1.4.8
Note
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.
Note
On Windows you may get an ImportError when you try to run django-admin.py. This is because Windows does not run the Python interpreter from your virtual environment unless you invoke it directly. Instead, prefix all commands that use .py files with python and use the full path to the file, like so:
> python %USERPROFILE%\Envs\django-workshop\Scripts\django-admin.py