~2 min read • Updated Feb 21, 2026
1. Overview
This document explains how to install a Python™ WSGI web application from the command line. Python WSGI is a standardized interface that allows Python applications to run on web servers.
For more information, refer to the Python WSGI documentation and cPanel’s guide on using Python on AlmaLinux, Rocky Linux, Ubuntu, and CloudLinux 9 and later.
Warning: WebPros International, LLC does not develop or support Python WSGI applications. cPanel Technical Support cannot assist with these applications. You are responsible for any data loss.
2. Pre‑Installation Settings
Note: Perform all steps as a cPanel user unless otherwise specified. You may also use cPanel’s Terminal interface.
In this guide, pythonapp represents the application name.
Your hosting provider must install pip and the required EasyApache 4 packages.
2.1 Required Packages for CentOS 7, AlmaLinux 8, Rocky Linux 8
ea-ruby27-mod_passengerea-apache24-mod_env
Recommended: ea-ruby27-ruby-devel
2.2 Required Packages for AlmaLinux 9 / Rocky Linux 9
ea-apache24-mod-passengerea-apache24-mod_env
Passenger automatically uses the newest installed versions of Ruby, NodeJS, and Python.
3. Install a Python Application
3.1 Create the Application Directory
mkdir directoryname
3.2 Create a Virtual Environment
virtualenv --python=python3 directoryname
If virtualenv is missing:
pip install virtualenv
3.3 Activate the Virtual Environment
cd directoryname
source bin/activate
3.4 Create the WSGI File
Create passenger_wsgi.py with the following content:
import sys, os
INTERP = "/home/username/pythonapp/bin/python"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
from pythonapp import app as application
3.5 Install Dependencies
Create a requirements.txt file, then run:
pip install -r requirements.txt
Warning: Dependency versions must match your Python version.
4. Test the Application
Run the application:
python pythonapp.py
Expected output:
Hello, World!
In another terminal:
curl http://localhost:5000
5. Register the Application
Use:
cPanel » Home » Software » Application Manager
Access the application at:
http://example.com/pythonapp
6. Restart the Application
Create a restart.txt file inside the /tmp directory:
pythonapp/tmp/restart.txt
Passenger restarts the application when this file is touched.
Conclusion
This guide covers the complete process of installing, configuring, testing, and registering a Python WSGI application in cPanel. By following these steps, you can deploy Python applications efficiently using Passenger.
Written & researched by Dr. Shahin Siami