================================How to install Django on Windows================================.. highlight:: dosconThis document will guide you through installing Python 3.8 and Django onWindows. It also provides instructions for setting up a virtual environment,which makes it easier to work on Python projects. This is meant as a beginner'sguide for users working on Django projects and does not reflect how Djangoshould be installed when developing patches for Django itself.The steps in this guide have been tested with Windows 10. In otherversions, the steps would be similar. You will need to be familiar with usingthe Windows command prompt... _install_python_windows:Install Python==============Django is a Python web framework, thus requiring Python to be installed on yourmachine. At the time of writing, Python 3.8 is the latest version.To install Python on your machine go to https://www.python.org/downloads/. Thewebsite should offer you a download button for the latest Python version.Download the executable installer and run it. Check the boxes next to "Installlauncher for all users (recommended)" then click "Install Now".After installation, open the command prompt and check that the Python versionmatches the version you installed by executing::...\> py --version.. seealso::For more details, see :doc:`python:using/windows` documentation.About ``pip``=============`pip`_ is a package manager for Python and is included by default with thePython installer. It helps to install and uninstall Python packages(such as Django!). For the rest of the installation, we'll use ``pip`` toinstall Python packages from the command line... _pip: https://pypi.org/project/pip/.. _virtualenvironment:Setting up a virtual environment================================It is best practice to provide a dedicated environment for each Django projectyou create. There are many options to manage environments and packages withinthe Python ecosystem, some of which are recommended in the `Pythondocumentation <https://packaging.python.org/guides/tool-recommendations/>`_.Python itself comes with :doc:`venv <python:tutorial/venv>` for managingenvironments which we will use for this guide.To create a virtual environment for your project, open a new command prompt,navigate to the folder where you want to create your project and then enter thefollowing::...\> py -m venv project-nameThis will create a folder called 'project-name' if it does not already existand set up the virtual environment. To activate the environment, run::...\> project-name\Scripts\activate.batThe virtual environment will be activated and you'll see "(project-name)" nextto the command prompt to designate that. Each time you start a new commandprompt, you'll need to activate the environment again.Install Django==============Django can be installed easily using ``pip`` within your virtual environment.In the command prompt, ensure your virtual environment is active, and executethe following command::...\> py -m pip install DjangoThis will download and install the latest Django release.After the installation has completed, you can verify your Django installationby executing ``django-admin --version`` in the command prompt.See :ref:`database-installation` for information on database installationwith Django.Colored terminal output=======================A quality-of-life feature adds colored (rather than monochrome) output to theterminal. In modern terminals this should work for both CMD and PowerShell. Iffor some reason this needs to be disabled, set the environmental variable:envvar:`DJANGO_COLORS` to ``nocolor``.On older Windows versions, or legacy terminals, colorama_ must be installed toenable syntax coloring::...\> py -m pip install coloramaSee :ref:`syntax-coloring` for more information on color settings... _colorama: https://pypi.org/project/colorama/Common pitfalls===============* If ``django-admin`` only displays the help text no matter what argumentsit is given, there is probably a problem with the file association inWindows. Check if there is more than one environment variable set forrunning Python scripts in ``PATH``. This usually occurs when there is morethan one Python version installed.* If you are connecting to the internet behind a proxy, there might be problemsin running the command ``py -m pip install Django``. Set the environmentvariables 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* In general, Django assumes that ``UTF-8`` encoding is used for I/O. This maycause problems if your system is set to use a different encoding. Recentversions of Python allow setting the :envvar:`PYTHONUTF8` environmentvariable in order to force a ``UTF-8`` encoding. Windows 10 also provides asystem-wide setting by checking ``Use Unicode UTF-8 for worldwide languagesupport`` in :menuselection:`Language --> Administrative Language Settings--> Change system locale` in system settings.