How to publish a Python application (Django or Flask) in cPanel

If your cPanel has the new design and you do not see Setup Python App, click Classic cPanel theme (top right): it is in the Software section.

With Setup Python App you publish a Python web application, such as Django or Flask, on your domain with the version you choose: 3.14, 3.13, 3.12 and older. cPanel creates a separate virtual environment for each application, so their libraries do not mix.

Before starting: your plan must include applications. Most Cloud Web Hosting plans allow up to four. If you do not see Setup Python App in cPanel, write to us.

1. Create the application

  1. In cPanel → Software, open Setup Python App and click Create Application.
  2. Python version: the one your project needs; for a new one, 3.14 if your libraries support it, otherwise 3.13.
  3. Application root: the folder for the code, e.g. myapp. Do not use a name like python314: it clashes with internal names and the app fails.
  4. Application URL: the domain or subdomain, and a path if not at the root.
  5. Application startup file: leave passenger_wsgi.py. Application Entry point: leave application.
  6. Click Create.

2. Connect your code

Upload your project to the application folder and edit passenger_wsgi.py so it exposes your app as application:

  • Django: from myproject.wsgi import application, where myproject is the folder containing wsgi.py.
  • Flask: from app import app as application, if your Flask object is called app and lives in app.py.

3. Install dependencies

  1. On the application screen, under Configuration files, type requirements.txt and click Add.
  2. Click Run Pip Install and choose that file.
  3. Add to Environment variables what your app reads, such as DJANGO_SETTINGS_MODULE or the database connection string.
  4. Click Restart.

If your plan has SSH or Terminal, the command starting with source at the top of the screen puts you in the app's virtual environment, where you can run pip install, python manage.py migrate or collectstatic.

Changing version

Edit the application and choose another Python version. Each version has its own environment, so run Run Pip Install again afterwards and restart.

If it does not load

  • 500 or “Something went wrong”: almost always an import failing in passenger_wsgi.py. The stderr.log file in the application folder says which.
  • You changed the code and nothing changes: click Restart.
  • Django static files without styles: run collectstatic and serve the static folder from public_html or with your project's configuration.

More information


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 150