Install Django framework using pip

Posted under » Django on 06 April 2021

When you install LAMP, php is installed with apache and mysql but in django you have to install them individually. I do not think you want to use SQLite or the built in web server that uses port 8080. You can also use Nginx but it is not recommended because of the slower performance.

First you need to install Python Apache Mod_wsgi. The mod_wsgi is an Apache module used to serve Python scripts over HTTP.

You should then install venv.

While under the activated environment, you may then install Django by

$ pip3 install Django==3.1.5

Note : Do not install as SUDO or root because it will break packages.

You may note that you can select the version number of your choice. As of writting, 3.1.5 is the latest version..

You may also install the latest version by

$git clone git://github.com/django/django ~/directory-of-choice

If you want to check the Django version, open a Python console and type

>>> import django
>>> django.VERSION
(3, 1, 5, 'final', 0)

Or simply.

$ django-admin --version

Then you need to install the MySQLclient as I don't assume you will use sqlite.

Now you may proceed to start a django website.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS