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
Flask
gunicornfrom flask import Flask
app = Flask(__name__)
@app.get('/')
def home():
return 'My Python website is online'
gunicorn --bind 0.0.0.0:$SERVER_PORT --workers 2 app:appFastAPI 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.
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.
Related guides
Website hosting: start here
Choose free or premium website hosting, understand the dashboards, and follow the right setup guide.
Create your free website
A complete walkthrough of the free website wizard, from choosing a runtime to your first public page.
Premium website plans and checkout
Choose a monthly website plan, review the cart, and understand delivery and renewal.
Choose Static HTML, PHP, Node.js or Python
Match your project to a website type before creating the server.