Deploying a Python Application

Python apps on ServerPlane run with a WSGI server and include automatic dependency installation. A virtual environment is automatically created and requirements.txt is installed during deployment.

Deployment Steps

  1. Navigate to Apps > Deploy Application.
  2. Select a server with an "Active" status.
  3. Choose "Python" as the application type.
  4. Configure the app:
    • App Name — a human-readable label.
    • Domain — the domain that will serve the app. DNS must already point to your server.
    • Python Version — choose from 3.10, 3.11, or 3.12. The default is 3.12.
    • Application Port — the port your Python app listens on. Default is 8000.
    • Git Repository (optional) — provide a repo URL to deploy existing code, or browse your connected GitHub repos.
    • Branch — defaults to main.
  5. Review and click Deploy.

What Happens During Deployment

  1. Required server software is installed if not already present.
  2. A Python virtual environment is created with the selected Python version.
  3. Dependencies are installed (pip and the WSGI server are set up automatically).
  4. If a Git repo was provided:
    • The repository is cloned to the server.
    • pip install -r requirements.txt runs automatically (if the file exists).
  5. If no Git repo was provided, a starter WSGI application (app.py) is created so the app has something to serve immediately.
  6. The app is started as a managed service with automatic restarts.
  7. A web server configuration is created to route your domain to the app port.

WSGI Module

The WSGI server needs to know your application's entry point. The default configuration expects a module named app with a callable named application — i.e., app:application. Common framework patterns:

  • Flask: a file app.py containing app = Flask(__name__) — the server runs app:app.
  • Django: use myproject.wsgi:application.

If your WSGI entry point differs from the default, you can update it via the web terminal or SFTP.

Managing the Service

App lifecycle actions (start, stop, restart) are available from the app's detail page. Environment variables set through the Environment tab are automatically loaded when the app restarts.

Notes

  • Private GitHub repositories are supported with automatic deploy key setup.
  • SSL can be provisioned after deployment via the Domains & SSL tab.
  • To install additional Python packages, use the web terminal to activate the virtual environment and run pip install <package>.