Set up Django on the latest Plesk Onyx with this handy guide from the top experts at Bobcares.
At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Services.
Let’s take a look at how our Support Team is ready to help customers set up Django on the latest Plesk Onyx.
How to set up Django on the latest Plesk Onyx
Our Support Techs have come up with this handy guide to help set up Django on the latest versions of Plesk Onyx. The process involves the following steps:
Install Python
Pre-configure the web server-management
Deploy the web
Step 1: Installing Python
First, we have to check if Python is already present in the system. We can do this by issuing the following command with root server access:
python36 –version
If Python is present, we are likely to see an output similar to the one below:
Python 3.6.6
However, if the command does not yield an output, we can install Python with the help of these commands:
Add EPEL repository and then install Python 3.6 with the commands below:
Our Support Team would like to point out it is a common practice to ensure there is a separate virtual environment for each Python application. We do this by installing the “virtualenv” package with the following command:
python36 -m pip install virtualenv
After that, we will install Phusion Passenger as we will be using it as an application server for hosting Django projects:
Our Support Engineers would like to point out that we have to replace the variable values in lines 2 and 3 with the corresponding accurate values and then save the file.
Next, create Django project and allow serving requests from any host:
django-admin startproject djangoProject
sed -i "s/ALLOWED_HOSTS = []/ALLOWED_HOSTS = ['*']/" djangoProject/djangoProject/settings.py
Then, create a tmp directory for application caches and restart the application:
mkdir tmp
touch tmp/restart.txt
Finally, change Domain Document Root and we will see the application if the procedure is successful.