Python on cPanel: Complete 7-Step Beginner’s Guide with Python Selector
🐍 Introduction
Do you want to run Python applications on cPanel without a dedicated server?
With CloudLinux’s Python Selector, you can easily choose your Python version and manage your applications directly from cPanel.
This comprehensive beginner-friendly guide shows you step by step how to create, upload, configure, and launch your Python application.
With this guide, you will learn how to:
- Create a Python application on cPanel
- Upload and organize your files properly
- Install dependencies using pip
- Restart and manage your application easily
You don’t need a dedicated server or advanced skills to follow this tutorial.
🔧 What You’ll Need
- A cPanel account with a CloudLinux-compatible hosting provider.
- The Setup Python App module enabled (Python Selector).
- A Python version such as 3.9, 3.10, or 3.11.
- Your Python project ready to upload (Flask or Django recommended).
- SSH or FTP/SFTP access to transfer your files.
🚀 Step 1: Creating Your Python Application
- Log in to cPanel:
https://yourdomain.com:2083 - Go to Software → Setup Python App.
- Click Create Application and configure:
- Python Version: choose the version you want.
- Application Root: e.g.,
pythonapp - Application URL: e.g.,
https://yourdomain.com/pythonapp - Startup File: e.g.,
app.pyorwsgi.py
- Click Create, then temporarily stop the application (we’ll start it after uploading your code).
📂 Step 2: Uploading Files
- Log in via FTP/SFTP or cPanel File Manager.
- Upload all files except your local
venv(virtual environment). - Ensure that
requirements.txtand the startup file are present.
📦 Step 3: Installing Dependencies
Open the integrated terminal or connect via SSH, then type:
cd pythonapp
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txtTip: Always install dependencies on the server for the application to work correctly.
🧠 Step 4: Managing Your Application
- Restart the application after each change using the Restart button.
- Change Python version if needed via Python Selector.
- Check logs:
~/pythonapp/logsor via SSH:tail -f ~/pythonapp/logs/error.log - Environment Variables: configure your keys and secrets in cPanel (e.g.,
SECRET_KEY).
🧩 Step 5: Example Flask Application
# app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome to your Python application via cPanel Python Selector!"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)💡 Step 6: Tips for Beginners
- Follow the order: creation → upload → install dependencies → start.
- Never copy your local
venvfolder; always create the environment on the server. - Test your application after each change to quickly detect errors.
- Document your environment variables to avoid losing keys or secrets.
❓ Step 7: Beginner FAQ
- Q: Can I use any Python version?
A: Use a version supported by your hosting provider, such as 3.9, 3.10, or 3.11. - Q: Should I copy my local
venvfolder?
A: No, always create the virtual environment on the server. - Q: How do I know if my application is working?
A: Visit the application URL defined in cPanel and check that the page loads correctly.





