You can run Python web applications like Flask and Django directly on Flashcloud shared hosting. The setup does not require a VPS or manual reverse proxy configuration. You create the environment using cPanel's Setup Python App tool, which isolates dependencies in a dedicated virtual environment and hooks your code into the LiteSpeed web server.
The Python runtime is fixed to Python 3.11.16 on our servers. For best results, assign your Python application to its own subdomain rather than a subpath of an existing website. If your main domain runs WordPress, its rewrite rules can intercept requests and cause 404 errors on downstream application routes.
Creating the Python application
Log in to cPanel from your hosting service page in the portal. Open Setup Python App under the Software section.
Click Create Application and configure the core fields:
- Python version: Select
3.11.16. - Application root: The folder inside your home directory where your code lives, such as
flaskappormyproject. Do not place this insidepublic_html. - Application URL: Select your domain or subdomain from the dropdown. You can leave the path empty (root) or specify a subfolder. Using a dedicated subdomain with an empty path is strongly recommended.
- Application startup file: The entry script, usually
app.pyfor Flask orpassenger_wsgi.py. - Application Entry point: The callable WSGI object inside your startup file, typically
appfor Flask orapplicationfor Django.
Click Create. The tool generates starter files inside your application root (including app.py, passenger_wsgi.py, public/, and tmp/), creates a virtual environment at ~/virtualenv/<root>/3.11, and writes server directives (PassengerAppRoot, PassengerBaseURI, PassengerPython) into the relevant .htaccess file. Never remove those comment markers from .htaccess, as LiteSpeed relies on them to serve your app.
Uploading code and managing dependencies
Once the skeleton exists, move your actual project files into the application root. You can transfer files using the File Manager tile in the portal, an FTP client, or Git. If you use version control, you can review deploying a Python app (Flask or Django) and our guide to using the Git Version Control tile to pull changes from remote repositories.
Your requirements.txt file is not automatically detected upon upload. To install your dependencies through the interface:
- Navigate back to Setup Python App and click the pencil icon next to your application.
- Locate the Configuration files section.
- Type
requirements.txtinto the text box labeled Add another file and press enter, then press Enter. - Click Run Pip Install. A dropdown will let you select
requirements.txt. - Wait for the confirmation toast stating
PIP Install completed successfully.
There is no in-browser terminal tool in cPanel. If you prefer using a command-line interface to install packages or manage dependencies, open your terminal and connect via an SSH client using the credentials from cPanel's SSH Access tool, similar to running Composer in our Symfony and CakePHP guides. The top banner inside Setup Python App displays the exact command to activate your virtualenv over SSH:
source /home/username/virtualenv/flaskapp/3.11/bin/activate && cd /home/username/flaskapp
Configuring Flask versus Django
The difference between running Flask and Django comes down to where the WSGI callable is defined.
Flask configuration
A minimal Flask application exposes the callable directly in your startup script. For an app.py file containing app = Flask(__name__), set the Application startup file to app.py and the Application Entry point to app. The generated passenger_wsgi.py will bridge this automatically, or you can import your callable directly inside passenger_wsgi.py:
from app import app as application
Django configuration
Django projects isolate the callable inside a wsgi.py file within your inner project folder (for example, myproject/wsgi.py). To hook this up:
- Set the Application startup file to
passenger_wsgi.py. - Set the Application Entry point to
application. - Edit
passenger_wsgi.pyin your project root to point to your Django WSGI handler:
import os import sys sys.path.insert(0, os.path.dirname(__file__)) from myproject.wsgi import application
To run database migrations such as python manage.py migrate, connect to your account using an SSH client, run the virtual environment activation command shown in the cPanel interface, and execute the migration commands directly from your project root.
Environment variables and debugging
Never hard-code sensitive database passwords or API credentials into your application files. Setup Python App provides an environment variables manager:
- Inside your application view, scroll to Environment variables.
- Click Add Variable.
- Enter the variable Name and Value, then click Done.
- Click Save at the top of the interface, then click Restart.
The panel writes these entries as SetEnv directives in your directory's .htaccess. Your code reads them cleanly through standard Python:
import os
db_password = os.environ.get('DB_PASSWORD')
If your application crashes on startup or returns a 500 error, check stderr.log inside your application root directory. All unhandled Python tracebacks and WSGI import failures are written there.
When to contact support
If your application reports internal errors, check stderr.log and verify your requirements.txt packages completed installation. If your application works locally but crashes on import, or if you encounter file permission locks while updating your virtual environment, open a ticket via the portal (Support → New ticket). Our team can inspect the LiteSpeed runner logs to help diagnose underlying server faults.