Django 2.0.3 installation - compressed package method

OS: Windows 10 Home Chinese, CPU: Intel Core i5-8250U

Python version: Python 2.7, Python 3.6

Django version: 2.0.3 (latest 2.0.5)

Decompression tool: 7-zip 64-bit version

 

Goal: Install Django 2.0.3 to Python 3.6

 

After reading some articles, I found that there are two ways to install Django: installation based on compressed packages , and installation using the pip tool.

This article uses the first method to install Django (downloaded the installation package on the 1st of last month, and just opened the first article in the reference link, but the first article

The version of Django in the reference article is 1.6.2, you need to modify the environment variable path after installation, but you do not need to install 2.0.3).

 

The specific installation process (performed according to the first article of the reference link):

1. Open the Django official website, download the latest installation package, and unzip the installation package

The downloaded installation package is Django-2.0.3 .tar.gz ;

For the first time, use 7-zip to decompress and get a dist directory;

Enter the dist directory, decompress the Django-2.0.3.tar, and get the Django-2.0.3 directory;

Complete decompression.

 

2. Copy the Django-2.0.3 directory to the parent directory of the Python 3.6 installation directory

i.e. the same parent directory for Django and Python.

Doubt: Not sure if you have to put both this way, or, Django can be in any directory.

The installation command requires the setup.py file in the Django directory, so you can check the content of setup.py:

From the content of setup.py, Django 2.0.3 can only be installed to Python 3.4 and above, otherwise, an error will be reported and the installation will be terminated !

 

3. Install Django-2.0.3

Open the command line tool and enter the Django-2.0.3 directory;

Execute the command python3 setup.py install to start installing Django, and the installation process lasts for a few minutes;

Note: If the computer only has Python 3.6 installed, you can use the python command directly, but my computer has both versions 2.7 and 3.6, and will

Its parsing command is changed to python2, python3;

The command line serial port prompts that the installation is successful;

 

Where is Django installed? Django will be installed to Django-2.0.3-py3.6.egg under site-packages under Python's Lib (different from the article 1 of the reference link).

The specific content under the directory, I still need to continue to study .

 

In addition, there are also two files starting with django in the C:\Python36\Scripts directory:

According to some information I have read, the django-admin command is used to create (manage) Django sites , and further research is needed .

Note that, unlike the steps in the reference link article 1, there is no need to modify the environment variable path (C:\Python36\Scripts was added when Python was installed before, and

Django-2.0.3 does not need to add other environment variables, and the official website is not found)!

 

4. Verify that the installation was successful

a. Use the django-admin command to view the version on the command line

b. Import the django module on the Python 3.6 command line and get the version

 

other:

The installation method of pip seems to be very simple. The following figure is the official guide. After entering the command, everything is automatically completed (article 2 from the reference link):

 

Follow up:

Uninstall (remove) Django (refer to linked article 2), upgrade Django, Django site migration...

 

Author: Ben.Z

Reference link:

Django installation
How to install Django on Windows
django2 quick installation guide

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325124159&siteId=291194637