2014-03-19 19:38:12 +01:00
|
|
|
================================
|
|
|
|
How to install Django on Windows
|
|
|
|
================================
|
|
|
|
|
|
|
|
This document will guide you through installing Python and Django for basic
|
|
|
|
usage on Windows. This is meant as a beginner's guide for users working on
|
|
|
|
Django projects and does not reflect how Django should be installed when
|
|
|
|
developing patches for Django itself.
|
|
|
|
|
|
|
|
The steps in this guide have been tested with Windows 7 and 8. In other
|
|
|
|
versions, the steps would be similar.
|
|
|
|
|
|
|
|
Install Python
|
|
|
|
==============
|
|
|
|
|
|
|
|
Django is a Python web framework, thus requiring Python to be installed on your
|
|
|
|
machine.
|
|
|
|
|
2014-12-19 16:25:57 +01:00
|
|
|
To install Python on your machine go to https://python.org/download/, and
|
2014-03-19 19:38:12 +01:00
|
|
|
download a Windows MSI installer for Python. Once downloaded, run the MSI
|
|
|
|
installer and follow the on-screen instructions.
|
|
|
|
|
|
|
|
After installation, open the command prompt and check the Python version by
|
|
|
|
executing ``python --version``. If you encounter a problem, make sure you
|
|
|
|
have set the ``PATH`` variable correctly. You might need to adjust your
|
|
|
|
``PATH`` environment variable to include paths to the Python executable and
|
|
|
|
additional scripts. For example, if your Python is installed in
|
|
|
|
``C:\Python34\``, the following paths need to be added to ``PATH``::
|
|
|
|
|
|
|
|
C:\Python34\;C:\Python34\Scripts;
|
|
|
|
|
|
|
|
Install Setuptools
|
|
|
|
==================
|
|
|
|
|
|
|
|
To install Python packages on your computer, Setuptools is needed. Download the
|
2014-12-19 16:25:57 +01:00
|
|
|
latest version of `Setuptools <https://pypi.python.org/pypi/setuptools>`_ for
|
2014-03-19 19:38:12 +01:00
|
|
|
your Python version and follow the installation instructions given there.
|
|
|
|
|
|
|
|
Install PIP
|
|
|
|
===========
|
|
|
|
|
2015-08-08 13:56:37 +02:00
|
|
|
`PIP <https://pip.pypa.io/>`_ is a package manager for Python that
|
2014-12-19 16:25:57 +01:00
|
|
|
uses the `Python Package Index <https://pypi.python.org>`_ to install Python
|
2014-04-09 13:37:57 +02:00
|
|
|
packages. PIP will later be used to install Django from PyPI. If you've
|
|
|
|
installed Python 3.4, ``pip`` is included so you may skip this section.
|
2014-03-19 19:38:12 +01:00
|
|
|
|
|
|
|
Open a command prompt and execute ``easy_install pip``. This will install
|
|
|
|
``pip`` on your system. This command will work if you have successfully
|
|
|
|
installed Setuptools.
|
|
|
|
|
2015-08-08 13:56:37 +02:00
|
|
|
Alternatively, go to `<https://pip.pypa.io/en/latest/installing.html>`_
|
2014-03-19 19:38:12 +01:00
|
|
|
for installing/upgrading instructions.
|
|
|
|
|
|
|
|
Install Django
|
|
|
|
==============
|
|
|
|
|
|
|
|
Django can be installed easily using ``pip``.
|
|
|
|
|
|
|
|
In the command prompt, execute the following command: ``pip install django``.
|
|
|
|
This will download and install Django.
|
|
|
|
|
|
|
|
After the installation has completed, you can verify your Django installation
|
2014-07-26 13:21:52 +02:00
|
|
|
by executing ``django-admin --version`` in the command prompt.
|
2014-03-19 19:38:12 +01:00
|
|
|
|
|
|
|
See :ref:`database-installation` for information on database installation
|
|
|
|
with Django.
|
|
|
|
|
|
|
|
Common pitfalls
|
|
|
|
===============
|
|
|
|
|
2014-07-26 13:21:52 +02:00
|
|
|
* If ``django-admin`` only displays the help text no matter what arguments
|
2014-03-19 19:38:12 +01:00
|
|
|
it is given, there is probably a problem with the file association in
|
|
|
|
Windows. Check if there is more than one environment variable set for
|
|
|
|
running Python scripts in ``PATH``. This usually occurs when there is more
|
|
|
|
than one Python version installed.
|
|
|
|
|
|
|
|
* If you are connecting to the internet behind a proxy, there might be problem
|
|
|
|
in running the commands ``easy_install pip`` and ``pip install django``.
|
|
|
|
Set the environment variables for proxy configuration in the command prompt
|
|
|
|
as follows::
|
|
|
|
|
|
|
|
set http_proxy=http://username:password@proxyserver:proxyport
|
|
|
|
set https_proxy=https://username:password@proxyserver:proxyport
|