Django - Installation


How can we install django?

This is probably depending on the package manager for your operating system. To install the official release using pip:

  1. Install pip. The easiest is to use the standalone pip installer. If your distribution already has pip installed, you might need to update it if it’s outdated. If it’s outdated, you’ll know because installation won’t work.
  2. Take a look at virtualenv and virtualenvwrapper. These tools provide isolated Python environments, which are more practical than installing packages systemwide. They also allow installing packages without administrator privileges. The contributing tutorial walks through how to create a virtualenv on Python 3.
  3. After you’ve created and activated a virtual environment, enter the command pip install Django at the shell prompt.

Where can we find packages for django?


Do we need to install Apache and mod_wsgi for our development environment?

No. Django includes a lightweight web server you can use for testing, so you won’t need to set up Apache until you’re ready to deploy Django in production.

How can we remove the old version of django?

If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version. If you installed Django using pip or easy_install previously, installing with pip or easy_install again will automatically take care of the old version, so you don’t need to do it yourself.

If you previously installed Django using python install, uninstalling is as simple as deleting the django directory from your Python site-packages. To find the directory you need to remove, you can run the following at your shell prompt (not the interactive Python prompt):

python -c "import django; print(django.__path__)"

How can we verify that django is installed?

Run the 'python' command from the command line. Then at the Python prompt, try to import Django:

>>> import django
>>> print(django.get_version())
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License