windows.txt 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ================================
  2. How to install Django on Windows
  3. ================================
  4. This document will guide you through installing Python 3.5 and Django on
  5. Windows. It also provides instructions for installing `virtualenv`_ and
  6. `virtualenvwrapper`_, which make it easier to work on Python projects. This is
  7. meant as a beginner's guide for users working on Django projects and does not
  8. reflect how Django should be installed when developing patches for Django
  9. itself.
  10. The steps in this guide have been tested with Windows 7, 8, and 10. In other
  11. versions, the steps would be similar. You will need to be familiar with using
  12. the Windows command prompt.
  13. Install Python
  14. ==============
  15. Django is a Python web framework, thus requiring Python to be installed on your
  16. machine. At the time of writing, Python 3.5 is the latest version.
  17. To install Python on your machine go to https://python.org/downloads/. The Web
  18. site should offer you a download button for the latest Python version. Download
  19. the executable installer and run it. Check the box next to ``Add Python 3.5 to
  20. PATH`` and then click ``Install Now``.
  21. After installation, open the command prompt and check that the Python version
  22. matches the version you installed by executing::
  23. python --version
  24. About pip
  25. =========
  26. `pip`_ is a package manage for Python. It makes installing and uninstalling
  27. Python packages (such as Django!) very easy. For the rest of the installation,
  28. we'll use ``pip`` to install Python packages from the command line.
  29. .. _pip: https://pypi.python.org/pypi/pip
  30. Install ``virtualenv`` and ``virtualenvwrapper``
  31. ================================================
  32. `virtualenv`_ and `virtualenvwrapper`_ provide a dedicated environment for
  33. each Django project you create. While not mandatory, this is considered a best
  34. practice and will save you time in the future when you're ready to deploy your
  35. project. Simply type::
  36. pip install virtualenvwrapper-win
  37. Then create a virtual environment for your project::
  38. mkvirtualenv myproject
  39. The virtual environment will be activated automatically and you'll see
  40. "(myproject)" next to the command prompt to designate that. If you start a new
  41. command prompt, you'll need to activate the environment again using::
  42. workon myproject
  43. .. _virtualenv: https://pypi.python.org/pypi/virtualenv
  44. .. _virtualenvwrapper: https://pypi.python.org/pypi/virtualenvwrapper-win
  45. Install Django
  46. ==============
  47. Django can be installed easily using ``pip``.
  48. In the command prompt, execute the following command::
  49. pip install django
  50. This will download and install the latest Django release.
  51. After the installation has completed, you can verify your Django installation
  52. by executing ``django-admin --version`` in the command prompt.
  53. See :ref:`database-installation` for information on database installation
  54. with Django.
  55. Common pitfalls
  56. ===============
  57. * If ``django-admin`` only displays the help text no matter what arguments
  58. it is given, there is probably a problem with the file association in
  59. Windows. Check if there is more than one environment variable set for
  60. running Python scripts in ``PATH``. This usually occurs when there is more
  61. than one Python version installed.
  62. * If you are connecting to the internet behind a proxy, there might be problem
  63. in running the command ``pip install django``. Set the environment variables
  64. for proxy configuration in the command prompt as follows::
  65. set http_proxy=http://username:password@proxyserver:proxyport
  66. set https_proxy=https://username:password@proxyserver:proxyport