Introduction to the Django Framework for Python Development (1) Django Installation

Source: Internet
Author: User
Tags install django pip install django

Django is a Python class library that must be installed before using Python. It is recommended to use Python3, the latest Django version that supports python2.7 is 1.11LTS.

First, installation method:

Install using the PIP command.

Pip Install django==2.1 (This command can specify the installation version)

Pip Install Django (this command installs the latest version)

Uninstalling an older version with PIP

How to get Django

Django is available open-source under the BSD license. We recommend using the latest version of Python 3. The last version of support for Python 2.7 is Django 1.11 LTS. See the FAQs for the Python versions supported by each version of Django. Here's how to get it:

Option 1:get the latest official version

The latest official version is 2.1. Read The 2.1 release notes, then install it with PIP:

pip install Django==2.1
Option 2:get the latest development version

The latest and greatest Django version is the one that's in our Git repository (our Revision-control system). This is a experienced users want to try incoming changes and help identify bugs before an official release. Get it using this shell command, which requires Git:

git clone https://github.com/django/django.git

You can also download a gzipped tarball of the development version. This archive is updated every time we commit code.

First, install the Django1. Installing Django via Pip

If you're installing Django through an upgrade, you'll need to uninstall the old version first.

Django offers 3 distributions, with the official stable version recommended:

    • The release version (Linux) that your operating system provides
    • Official stable version (recommended)
    • Developing beta versions

Django is essentially a class library of the Python language, so it can be installed with the PIP tool. This is also the easiest and best way to install. It is not recommended to install by downloading the installation package or compiling the source code, unless your environment cannot connect to the external network.

This article describes how the PIP command is installed under Windows System.

Win+r, call up cmd, Run command: pip install django , automatically install the latest version provided by PyPI.

You can use this form if you want to specify a version pip install django==1.10 .

After the installation is complete as shown:

If you see this tutorial, the Django version has changed a lot, then you may need to pay attention to the differences between some versions, the best way is to specify the same version of the installation and tutorial 1.11.6 .

In the Linux operating system, as well, use the PIP Toolkit to install Django.

2. Verifying the installation

Enter the python interactive environment (be sure to go to the Python interpreter that just installed Django) and view the installation version as follows:

Djangoprint(Django.  Get_version())1.11

We'll assume you with Django installed already. You can tell Django was installed and which version by running the following command in a shell prompt (indicated by the $ Prefix):

?/? ?
$ python-m Django--version



or pip list , use the command to see if a Django module exists.

3. Configuring the System environment

After successfully installing Django, in Windows, for example, a file can be found in the scripts directory under the Python root, django-admin.exe which is the Django core hypervisor, preferably added to the operating system's environment variables, which makes subsequent calls easier.

How to enter the environment variable settings interface, refer to the relevant section of the Python tutorial. Add the Scripts directory in the path variable, as shown in.

Back to the CMD interface, run django-admin help and see the following content to indicate that the environment variable is set successfully.


Introduction to the Django Framework for Python Development (1) Django Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.