+254725682556 +254725052660 info@ziprof.co.ke
Client Area

Hosting

How to Set Up a Python Application on Your Hosting Account

If your website or web app is built with Python (for example, a Flask or Django project), you don't need a separate server to run it. Shared hosting accounts include a built-in tool that creates an isolated Python environment for your application and connects it to the web server, so it runs alongside your other websites without conflicting with them.

The general idea is the same wherever you host: you create the application through your control panel, point it at a folder and a URL, then install your project's dependencies inside the environment the tool creates for you.

Before You Start

  • Know which Python version your application needs (check your project's documentation or a runtime.txt/requirements.txt file if you have one).
  • Have your project's requirements.txt file ready, or a list of the packages your app depends on.
  • Know your application's startup file and the name of the variable inside it that your web framework uses to handle requests (often called the WSGI application object).
Your Python app must be built to run behind a WSGI server (this is how Flask, Django, and most Python web frameworks work by default). It should not try to open its own network port, since shared hosting does not allow that.

In cPanel

  1. Log in to cPanel.
  2. Under the Software section, click Setup Python App.
  3. Click Create Application.
  4. Choose the Python version you need from the dropdown.
  5. Enter the Application root: the folder where your project's files will live (this can be inside or outside public_html, depending on whether the app should be reachable directly at your domain or at a specific path).
  6. Enter the Application URL: the domain, subdomain, or path where the app should be accessible.
  7. Enter the Application startup file (e.g. app.py) and the Application Entry point (the name of the WSGI object in that file, e.g. app).
  8. Click Create.

cPanel will create the application and show you a command to activate its virtual environment. Use the built-in Terminal (or an SSH client) to run that command, then run pip install -r requirements.txt from inside your application root to install your project's dependencies.

Upload your project files into the application root using File Manager or FTP, then return to Setup Python App and click Restart to apply your changes.

See how to use cPanel's built-in terminal if you'd rather run these commands from your browser than set up a separate SSH connection.

In DirectAdmin

Newer DirectAdmin installations (the Evolution skin) include a similar Setup Python App tool, usually found under Extra Features or Advanced Features. Where it's available, the steps match cPanel's: choose a Python version, set an application root and URL, set the startup file and entry point, then click Create.

Once the application exists, activate its virtual environment from the command shown on the setup page and run pip install -r requirements.txt to install your dependencies, then upload your project files and restart the application.

If your DirectAdmin account doesn't show a Setup Python App option, open a support ticket so ZIPROF can configure the Passenger integration for your Python application manually.

See how to use DirectAdmin's built-in terminal to run the activation and install commands without a separate SSH client.

Common Issues

  • If visiting your app's URL shows a generic error instead of your app, double-check the entry point name matches the variable in your startup file exactly.
  • If a package fails to install, make sure you activated the virtual environment first. Installing without activating it installs the package system-wide instead of into your app's isolated environment.
  • After any code change, restart the application from the Setup Python App page. Unlike PHP, changes to Python files are not picked up automatically.