Install Django?

Django is a Python-based free and open-source web module, thati s based on the model-template-view architectural pattern. The module is maintained by the Django Software Foundation (non-profit). You can use the Django module to create complex, database-driven websites.

Before you install Django, we recommend that you have Python 3 and the Python package manager install (pip3).

To test your Python version, open the command prompt and type:

python --version

On some systems both versions of Python are installed, in that case use python3. Django works with both versions of Python, but Python 2 is legacy.

You may like: Django Web Developer Course

Installing Django

You can use Python’s package manager to install the Django web framework. The first thing you’ll want to do is open a terminal. Then you can pip to install django:

pip3 install django

We then see:

pip3 install django
[sudo] password for user: 
Collecting django
  Downloading Django-1.11.3-py2.py3-none-any.whl (6.9MB)
    100% |████████████████████████████████| 7.0MB 107kB/s 
Requirement already satisfied: pytz in /usr/lib/python3.6/site-packages (from django)
Installing collected packages: django
Successfully installed django-1.11.3

It’s recommneded that you do installation of Django inside a virtual envrionment (virtualenv).

You can verify that it’s successfully installed using the Python shell, python by typing import django.

If it’s not succesfully installed you’ll get the following error:

python3
Python 3.7.5 (default, Nov 20 2019, 09:21:52) 
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'django'
>>> 

Django version

You can check your version using Python. To do that, you can run a single command.
Start a terminal (or command prompt on windows).

On Linux and Mac OS X:

python3 -m django --version

On Microsoft Windows:

py -3 -m django --version