Deploy your first Python app on NeoHeberg
Python on application hosting works like Node.js: you provide an entry point, declared dependencies and a server that listens on the platform port. No system access or virtualenv activation is needed on the service side.
Prepare the project
The default entry point is main.py. A minimal Flask example:
import os
from flask import Flask
app = Flask(__name__)
@app.get("/")
def index():
return "Online"
@app.get("/health")
def health():
return {"status": "ok"}
if __name__ == "__main__":
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", "8000")))Declare dependencies in requirements.txt, with precise versions:
Flask==3.0.3
gunicorn==22.0.0pip install -r requirements.txt runs at startup. Avoid heavy system dependencies: you cannot install apt packages on this hosting.
Create the service
In the dashboard, choose application hosting, then Python and a version (3.12 or 3.11, for example). Name the service and check the allocated resources. The application must stay within these limits, memory included: a Python process loading a large model can exceed RAM before serving a single request.
Upload the files
Upload main.py, requirements.txt and your project files through the panel file manager, then extract the archive if needed. Do not upload .venv or __pycache__: they are local and may contain incompatible paths.
Start and verify
Start the service and open the console. You should see dependency installation, then server startup. Test the / and /health routes on the provided allocation. If Flask prints Running on http://0.0.0.0:..., the process is listening correctly.
For a real service, replace the Flask development server with Gunicorn if the start command allows it:
gunicorn --bind 0.0.0.0:$PORT main:appUpdate and secure
After a change, upload the files, restart and check the logs. Put secrets (API key, connection string) in the panel environment variables. Do not write them in main.py or in a .env file uploaded by mistake.
Advertisement
Was this article helpful?
Read next
- Deploy your first Node.js app on NeoHebergFrom local project to live service: prepare the code, create the service, upload files and start.
- Protect application secretsEnvironment variables, rotation, logs and Git: keep secrets out of the code.
- Back up application dataInventory, copy consistently, move the backup offsite and test the restore.