Learn how to efficiently install Django applications in Plesk with proper setup steps. Our Plesk Support team is ready to assist you.
Install Django Applications in Plesk
Set up Python apps with Phusion Passenger by installing Python, creating a virtual environment, and configuring Passenger with Apache or Nginx. Install Django, add your passenger_wsgi.py, configure the server, install dependencies, run migrations, and restart to ensure a stable, functional deployment.
Setting Up Python Applications with Phusion Passenger
- Connect via SSH
- Linux/macOS: ssh username@server_ip
- Windows: Use PuTTY with the server IP and port 22.
- Install Python and Virtual Environment
- Ubuntu/Debian: sudo apt install python3 python3-pip python3-venv
- CentOS/RHEL/Fedora: sudo dnf install python3 python3-pip python3-virtualenv
- Create and activate venv:
mkdir my_project && cd my_project
python3 -m venv .venv
source .venv/bin/activate
- Install and Configure Phusion Passenger (Nginx example)
- Add Passenger repository, install Nginx with Passenger.
Edit Nginx config to enable Passenger and point to your app:
passenger_enabled on;
passenger_app_type wsgi;
passenger_startup_file passenger_wsgi.py;
- Restart Nginx: sudo systemctl restart nginx
Configuring Plesk for Python Applications
To set up a Python application in Plesk, first explain the installation of Plesk, then enable Phusion Passenger using the Plesk installer and activate it in Apache or Nginx. First, to configure the web server, start by adding PassengerEnabled On, PassengerAppType wsgi, and PassengerStartupFile passenger_wsgi.py for Apache. Next, if you are instead using Nginx, you should alternatively include the corresponding settings, such as passenger_enabled on and passenger_app_root pointing to your application directory. Moreover, in addition to applying these configurations, you must also ensure that SSH access is properly granted for the system user. Finally, as the last step, confirm that a suitable shell, such as /bin/bash, is enabled so that deployment and management of the application can successfully proceed.

Next, deploy your Python application by creating a virtual environment in the document root, activating it, and installing all required dependencies using pip. You can also use Plesk Migration Manager to transfer application files efficiently. Place your passenger_wsgi.py file along with the application files in the correct directory so that Passenger can properly start and serve your Python application. Following these steps ensures a stable and correctly configured Python environment on your Plesk server.
Creating Virtual Environments
First, install Python and the virtual environment package. On Ubuntu or Debian, run sudo apt update followed by sudo apt install python3 python3-pip python3-venv. On RHEL, CentOS, or CloudLinux, install EPEL if needed and run sudo yum install python3 python3-pip python3-virtualenv.
Next, create a project directory (optional) with mkdir my_django_project and navigate into it. Create a virtual environment inside the directory using python3 -m venv myenv and activate it with source myenv/bin/activate. With the environment active, install Django using pip install Django. Once finished, deactivate the environment by running deactivate. This ensures all dependencies remain isolated within the virtual environment.
Installing Django and Application Dependencies
Step 1: Activate the Virtual Environment
Prior to installing Django, confirm that your virtual environment is active.
source myenv/bin/activateFollowing activation, the environment name (e.g., (myenv)) will appear at the start of your command prompt.
Step 2: Install Django
- Use pip to install Django inside the virtual environment.
- pip install Django
Step 3: Verify Django Installation
Check that Django is installed and confirm its version.
>
python -m django --versionStep 4: Create a Django Project
Set up a new Django project to create the required directory structure. Replace project_name with your desired project name.
>
django-admin startproject project_nameStep 5: Navigate to Project Directory
Move into the newly created project folder.
>
cd project_nameStep 6: Install Additional Dependencies (Optional)
In case your application has additional requirements, you can then install them using a requirements.txt file.
>
pip install -r requirements.txtStep 7: Deactivate Virtual Environment (Optional)
After finishing your work in the environment, you can then deactivate it, thereby returning to the system Python.
deactivate
Deploying the Django Application
- Move Project Files: Upload your Django project (including manage.py, app folders, settings, static/media files) to the domain’s httpdocs or a subdirectory,.
- Create passenger_wsgi.py: In the project root, create the file with:
import os, sys
sys.path.insert(0, os.path.dirname(__file__))
os.environ['DJANGO_SETTINGS_MODULE'] = 'your_project_name.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
- Set Document Root: In Plesk, adjust the domain’s Document Root to the folder containing passenger_wsgi.py.
- Configure Apache/Nginx: Add necessary directives for Passenger and static files; run python manage.py collectstatic for static assets.
- Finalize Setup: Activate your virtual environment, install dependencies (pip install -r requirements.txt), run migrations (python manage.py migrate), and restart the web server or Passenger app in Plesk.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Setting up and configuring the server properly allows you to efficiently install Django applications in Plesk, ensuring smooth deployment, isolated environments, and reliable application performance.
In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.
