Skip to content
🚀 Unlimited+ €3.99/month! Get unlimited credits, auto-renewals, one-click max-out, +5 Discord bot slots, up to 8GB RAM & 200% CPU, +5 email addresses/domain & +2 email domains!
X Systems Hosting
X Systems Hosting
X Systems Help Center

Deploy a Python web application

Use requirements.txt, the website virtual environment and a production web-server command.

Help Center / Web Hosting
On this page
  1. Prepare the project
  2. Flask example
  3. FastAPI example
  4. Check imports and resources

Prepare the project

Choose the Python website type. Put requirements.txt and your application source in the project root. The website runtime creates and uses its own .venv directory and can install requirements on startup. Do not upload a virtual environment built on a different computer.

This is the website runtime, not the Discord-bot Python egg. Website application startup is configured using the Startup command variable shown for this website.

Flask example

requirements.txt
Flask
gunicorn
app.py
from flask import Flask
app = Flask(__name__)

@app.get('/')
def home():
    return 'My Python website is online'
Application Startup command variable
gunicorn --bind 0.0.0.0:$SERVER_PORT --workers 2 app:app

FastAPI example

Install fastapi and uvicorn in requirements.txt, and make sure the module exposes an app object. Adjust the module name below if the file is not app.py.

Application Startup command variable
uvicorn app:app --host 0.0.0.0 --port "$SERVER_PORT"

Check imports and resources

  • ModuleNotFoundError usually means a missing dependency or a wrong virtual environment.
  • app:app means the Python module app and the application object app, not an arbitrary filename string.
  • Bind to 0.0.0.0 and the allocated port.
  • Choose worker counts that fit the RAM limit; more workers are not automatically faster.
  • Keep secrets out of source control and the public folder.