<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>How to install Django on Windows — Django 1.8.19 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '1.8.19', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="top" title="Django 1.8.19 documentation" href="../contents.html" /> <link rel="up" title="“How-to” guides" href="index.html" /> <link rel="next" title="Writing database migrations" href="writing-migrations.html" /> <link rel="prev" title="Deploying static files" href="static-files/deployment.html" /> <script type="text/javascript" src="../templatebuiltins.js"></script> <script type="text/javascript"> (function($) { if (!django_template_builtins) { // templatebuiltins.js missing, do nothing. return; } $(document).ready(function() { // Hyperlink Django template tags and filters var base = "../ref/templates/builtins.html"; if (base == "#") { // Special case for builtins.html itself base = ""; } // Tags are keywords, class '.k' $("div.highlight\\-html\\+django span.k").each(function(i, elem) { var tagname = $(elem).text(); if ($.inArray(tagname, django_template_builtins.ttags) != -1) { var fragment = tagname.replace(/_/, '-'); $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>"); } }); // Filters are functions, class '.nf' $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { var filtername = $(elem).text(); if ($.inArray(filtername, django_template_builtins.tfilters) != -1) { var fragment = filtername.replace(/_/, '-'); $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>"); } }); }); })(jQuery); </script> </head> <body role="document"> <div class="document"> <div id="custom-doc" class="yui-t6"> <div id="hd"> <h1><a href="../index.html">Django 1.8.19 documentation</a></h1> <div id="global-nav"> <a title="Home page" href="../index.html">Home</a> | <a title="Table of contents" href="../contents.html">Table of contents</a> | <a title="Global index" href="../genindex.html">Index</a> | <a title="Module index" href="../py-modindex.html">Modules</a> </div> <div class="nav"> « <a href="static-files/deployment.html" title="Deploying static files">previous</a> | <a href="index.html" title="&#8220;How-to&#8221; guides" accesskey="U">up</a> | <a href="writing-migrations.html" title="Writing database migrations">next</a> »</div> </div> <div id="bd"> <div id="yui-main"> <div class="yui-b"> <div class="yui-g" id="howto-windows"> <div class="section" id="s-how-to-install-django-on-windows"> <span id="how-to-install-django-on-windows"></span><h1>How to install Django on Windows<a class="headerlink" href="#how-to-install-django-on-windows" title="Permalink to this headline">¶</a></h1> <p>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.</p> <p>The steps in this guide have been tested with Windows 7 and 8. In other versions, the steps would be similar.</p> <div class="section" id="s-install-python"> <span id="install-python"></span><h2>Install Python<a class="headerlink" href="#install-python" title="Permalink to this headline">¶</a></h2> <p>Django is a Python web framework, thus requiring Python to be installed on your machine.</p> <p>To install Python on your machine go to <a class="reference external" href="https://python.org/download/">https://python.org/download/</a>, and download a Windows MSI installer for Python. Once downloaded, run the MSI installer and follow the on-screen instructions.</p> <p>After installation, open the command prompt and check the Python version by executing <code class="docutils literal"><span class="pre">python</span> <span class="pre">--version</span></code>. If you encounter a problem, make sure you have set the <code class="docutils literal"><span class="pre">PATH</span></code> variable correctly. You might need to adjust your <code class="docutils literal"><span class="pre">PATH</span></code> environment variable to include paths to the Python executable and additional scripts. For example, if your Python is installed in <code class="docutils literal"><span class="pre">C:\Python34\</span></code>, the following paths need to be added to <code class="docutils literal"><span class="pre">PATH</span></code>:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">C</span><span class="p">:</span>\<span class="n">Python34</span>\<span class="p">;</span><span class="n">C</span><span class="p">:</span>\<span class="n">Python34</span>\<span class="n">Scripts</span><span class="p">;</span> </pre></div> </div> </div> <div class="section" id="s-install-setuptools"> <span id="install-setuptools"></span><h2>Install Setuptools<a class="headerlink" href="#install-setuptools" title="Permalink to this headline">¶</a></h2> <p>To install Python packages on your computer, Setuptools is needed. Download the latest version of <a class="reference external" href="https://pypi.python.org/pypi/setuptools">Setuptools</a> for your Python version and follow the installation instructions given there.</p> </div> <div class="section" id="s-install-pip"> <span id="install-pip"></span><h2>Install PIP<a class="headerlink" href="#install-pip" title="Permalink to this headline">¶</a></h2> <p><a class="reference external" href="http://www.pip-installer.org/">PIP</a> is a package manager for Python that uses the <a class="reference external" href="https://pypi.python.org">Python Package Index</a> to install Python packages. PIP will later be used to install Django from PyPI. If you’ve installed Python 3.4, <code class="docutils literal"><span class="pre">pip</span></code> is included so you may skip this section.</p> <p>Open a command prompt and execute <code class="docutils literal"><span class="pre">easy_install</span> <span class="pre">pip</span></code>. This will install <code class="docutils literal"><span class="pre">pip</span></code> on your system. This command will work if you have successfully installed Setuptools.</p> <p>Alternatively, go to <a class="reference external" href="http://www.pip-installer.org/en/latest/installing.html">http://www.pip-installer.org/en/latest/installing.html</a> for installing/upgrading instructions.</p> </div> <div class="section" id="s-install-django"> <span id="install-django"></span><h2>Install Django<a class="headerlink" href="#install-django" title="Permalink to this headline">¶</a></h2> <p>Django can be installed easily using <code class="docutils literal"><span class="pre">pip</span></code>.</p> <p>In the command prompt, execute the following command: <code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">django</span></code>. This will download and install Django.</p> <p>After the installation has completed, you can verify your Django installation by executing <code class="docutils literal"><span class="pre">django-admin</span> <span class="pre">--version</span></code> in the command prompt.</p> <div class="versionchanged"> <span class="title">Changed in Django 1.7:</span> <p>In Django 1.7, a <code class="docutils literal"><span class="pre">.exe</span></code> has been introduced, so just use <code class="docutils literal"><span class="pre">django-admin</span></code> in place of <code class="docutils literal"><span class="pre">django-admin.py</span></code> in the command prompt.</p> </div> <p>See <a class="reference internal" href="../topics/install.html#database-installation"><span class="std std-ref">Get your database running</span></a> for information on database installation with Django.</p> </div> <div class="section" id="s-common-pitfalls"> <span id="common-pitfalls"></span><h2>Common pitfalls<a class="headerlink" href="#common-pitfalls" title="Permalink to this headline">¶</a></h2> <ul> <li><p class="first">If <code class="docutils literal"><span class="pre">django-admin</span></code> only displays the help text no matter what arguments 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 <code class="docutils literal"><span class="pre">PATH</span></code>. This usually occurs when there is more than one Python version installed.</p> </li> <li><p class="first">If you are connecting to the internet behind a proxy, there might be problem in running the commands <code class="docutils literal"><span class="pre">easy_install</span> <span class="pre">pip</span></code> and <code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">django</span></code>. Set the environment variables for proxy configuration in the command prompt as follows:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="nb">set</span> <span class="n">http_proxy</span><span class="o">=</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">username</span><span class="p">:</span><span class="n">password</span><span class="nd">@proxyserver</span><span class="p">:</span><span class="n">proxyport</span> <span class="nb">set</span> <span class="n">https_proxy</span><span class="o">=</span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">username</span><span class="p">:</span><span class="n">password</span><span class="nd">@proxyserver</span><span class="p">:</span><span class="n">proxyport</span> </pre></div> </div> </li> </ul> </div> </div> </div> </div> </div> <div class="yui-b" id="sidebar"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">How to install Django on Windows</a><ul> <li><a class="reference internal" href="#install-python">Install Python</a></li> <li><a class="reference internal" href="#install-setuptools">Install Setuptools</a></li> <li><a class="reference internal" href="#install-pip">Install PIP</a></li> <li><a class="reference internal" href="#install-django">Install Django</a></li> <li><a class="reference internal" href="#common-pitfalls">Common pitfalls</a></li> </ul> </li> </ul> <h3>Browse</h3> <ul> <li>Prev: <a href="static-files/deployment.html">Deploying static files</a></li> <li>Next: <a href="writing-migrations.html">Writing database migrations</a></li> </ul> <h3>You are here:</h3> <ul> <li> <a href="../index.html">Django 1.8.19 documentation</a> <ul><li><a href="index.html">“How-to” guides</a> <ul><li>How to install Django on Windows</li></ul> </li></ul> </li> </ul> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/howto/windows.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <h3>Last update:</h3> <p class="topless">Mar 10, 2018</p> </div> </div> <div id="ft"> <div class="nav"> « <a href="static-files/deployment.html" title="Deploying static files">previous</a> | <a href="index.html" title="&#8220;How-to&#8221; guides" accesskey="U">up</a> | <a href="writing-migrations.html" title="Writing database migrations">next</a> »</div> </div> </div> <div class="clearer"></div> </div> </body> </html>