Install Django in Windows and Django in Windows
Django is a very popular open-source web framework. Based on the MVC model, it emphasizes rapid development and has many powerful third-party plug-ins, developers can use these plug-ins to quickly and conveniently develop their own websites. This article describes how to install Django in Windows.
Install Python
As a Python web framework, you must install Python before installing django. However, different versions of django have different requirements for Python versions. For details, see the following table.
Django version |
Python version |
1.4 |
2.5, 2.6, 2.7 |
1.7, 1.8 |
2.7, 3.2, 3.3, 3.4 |
1.9 |
2.7, 3.4, 3.5 |
Install Python in Windows. You can download the Windows installation package from the official Python Website: Python download link.
For more information, see how to install Python in Windows.
Install Setuptools
To install the Python extension package, you must first install setuptools. For Windows, you can download ez_setup.py and run it using the Python command.
python ez_setup.py
For details about how to install setuptools, refer to setuptools or Baidu experience. [Python] how to install easy_install?
Install PIP
PIP is a Python Package management tool that uses Python Package Index to install Python packages.
First download the latest pip installation package, download page: https://pypi.python.org/pypi/pip#downloads
Decompress the package, enter the directory, and run:
python setup.py install
To install pip.
Or run the esay_install command to install pip:
easy_install pip
Uninstall the old version of Django
If you have usedpython setup.py install
After installing djangoSite-packagesDelete the django directory under the directory.
To know the location of the Directory, run the following command in cmd (note that it is not in the Python execution environment ):
python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"
Download Django code
The latest version of django code is put on GitHub. You can use the git command to obtain the latest version of django.
git clone https://github.com/django/django.git
Alternatively, download the django compressed package: Download link
If you need to use django in a formal production environment, we recommend that you select a stable version of django, such as django 1.8.
Install Django
Open cmd, enter the django code directory (for example, cd Django-X.Y), execute the command
python setup.py install
The cmd window displays a large set of installation information. wait patiently and the installation is complete.
If you use pip to install django, run the following command:
pip install django
Verify Installation
To verify whether the installation is successful, enter the following command at the Python prompt to verify the installation.
>>> import django>>> print(django.get_version())1.8
You can see that the django version is correctly output and the installation is successful.
Reference
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.