Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Django installation


May 14, 2021 Django


Table of contents


Django installation

Before you can install Django, the system needs to have Python's development environment installed.


Install Django under Window

If you haven't installed the Python environment, you'll need to download the Python installation package first.

1, Python download address: https://www.python.org/downloads/

2, Django download address: https://www.djangoproject.com/download/

Python installation (installed skipped)

To install Python you just need to download the python-x.x.x.msi file and click the "Next" button all the time.

Django installation

To check that our python was successfully installed, you can enter python in the command window to make a query, such as the information shown in Figure 1 below.

Django installation

Once installed, you need to set the Python environment variable. Right-click on the computer-attributes-advanced-environment variable-modify the system variable path, add the Python installation address, this example is using C: .

Django installation

Install the Django code

Installation instructions vary, depending on whether you install a distribution-specific package, download the latest official release, or get the latest development version.

Use to install the official version of pip

This is the recommended way to install Django.

  1. Install pip . T he easiest way is to use a separate pip installer. I f your distribution is already pip installed, you may need to update it if it is out of date. If it's out of date, you'll know, because the installation won't work.
  2. Take a look at venv. T he tool provides an isolated Python environment that is more practical than installing packages system-wide. I t also allows packages that do not have administrator rights to be installed. This contributing tutorial walks through how to create a virtual environment.
  3. After you create and activate the virtual environment, enter the following commands, depending on the operating system:
 Linux/MAC: python -m pip install Django
Windows: py -m pip 

Install distribution-specific packages

Check the release-specific instructions to see if your platform/release provides an official Django package/installer. Packages provided by the release typically allow dependencies and supported upgrade paths to be installed automatically;

Install the development version

Track Django development

If you decide to use the latest development version of Django, you need to pay close attention to the development schedule and want to keep an eye out for the upcoming release notes. T his will help you master all the new features you might want to use and any changes you'll need to make to your code when you update your Django copy. ( For stable versions, any necessary changes are recorded in the release notes.)

If you want to be able to update your Django code occasionally with the latest bug fixes and improvements, follow these instructions:

  1. Make sure that Git is installed and that its commands can be run from the shell. ( Enter at the shell prompt for testing.) )git help
  2. Check Django's main development branch like this:

Linux/MAC: $ git clone https://github.com/django/django.git

Windows:... \> git clone https://github.com/django/django.git

This django in the current directory.

3. Make sure that the Python interpreter can load Django's code. T he most convenient way is to use a virtual environment and pip. This contributing tutorial walks through how to create a virtual environment.

4. Once the virtual environment is set up and activated, run the following commands:

Linux/MAC:$ python -m pip install -e django/

Windows:   ... \> py -m pip install -e django \

This will allow Django's code to be imported django-admin Utility command available. In other words, you're ready!

When you want to update a copy of Django's source code, run the command from the directory. W hen you do this, Git downloads all the changes. git pulldjango

For more information: https://docs.djangoproject.com/en/3.0/topics/install/