How to Deploy a Python App in ChromeLabs cPanel
You can deploy a Python app (Flask, Django, FastAPI) in cPanel using Setup Python App. Follow these steps:
1️⃣ Check if Your Hosting Supports Python
- Log in to cPanel.
- Look for "Setup Python App" (inside the Software section).
- ✅ If available, continue.
- ❌ If missing, contact your hosting provider (some shared hosting plans don’t support Python).
2️⃣ Create a Python App in cPanel
- Go to → Setup Python App in cPanel.
- Click "Create Application".
- Select Python Version (Choose 3.x, like Python 3.8 or 3.9).
- Choose an Application Root Folder (e.g.,
public_html/myapp
). - Set the Application URL (e.g.,
https://yourdomain.com/myapp
). - Click "Create" – This sets up a virtual environment for your app.
3️⃣ Upload Your Python App
- Use File Manager or FTP to upload your Python files inside the Application Root Folder (
public_html/myapp
). - If using Flask, upload:
app.py
(your main Python file)requirements.txt
(list of dependencies)passenger_wsgi.py
(needed for deployment)
4️⃣ Install Dependencies
- In Setup Python App, click "Enter Virtual Environment" (SSH command line opens).
- Run: (Installs required Python libraries like Flask, Django, etc.)
5️⃣ Configure Passenger WSGI for Deployment
- Inside your app folder (
public_html/myapp
), create a file:
????passenger_wsgi.py
(For Django, importapplication
fromwsgi.py
instead.)
6️⃣ Restart the Python App
- Go back to Setup Python App.
- Click Restart Application.
- Visit https://yourdomain.com/myapp to check if it’s running.
✅ Example: Deploy a Flask App in cPanel
-
Create
app.py
inpublic_html/myapp
: -
Create
requirements.txt
(in the same folder): -
Create
passenger_wsgi.py
: -
Restart the app in cPanel → Done! ????
⚠️ Common Issues & Fixes
???? 500 Internal Server Error?
✔️ Check passenger_wsgi.py and restart the app.
???? ModuleNotFoundError?
✔️ Run pip install -r requirements.txt
inside the virtual environment.
???? Not loading at the domain?
✔️ Make sure the Application URL is correctly set in cPanel.