Deploy · Python
Python hosting for FastAPI, Django, and Flask.
Runex hosts Python web apps from GitHub: FastAPI with uvicorn, Django or Flask with gunicorn. Your app runs in an isolated container with HTTPS, and a managed PostgreSQL database is one click away.
- FastAPI, Django, Flask
- uvicorn or gunicorn
- Managed PostgreSQL
- runtime
- Python 3.12
- install
- pip install -r requirements.txt
- server
- uvicorn · 0.0.0.0:$PORT
- database
- DATABASE_URL · injected
- url
- https://api.runex.cloud
Definition
What does a Python web app need in production?
A production server, pinned dependencies, and configuration from environment variables.
Python frameworks don't serve production traffic on their own dev servers. FastAPI runs on an ASGI server such as uvicorn; Django and Flask run on a WSGI server such as gunicorn.
Runex runs that server command in an isolated container, installs dependencies from requirements.txt, and serves the app over HTTPS.
Settings like DATABASE_URL and SECRET_KEY come from environment variables, so the same code runs in previews and production.
How to deploy
How do you deploy a Python app on Runex?
Pin dependencies, define the start command, push.
-
You
Pin dependencies
Commit requirements.txt with versions.
-
You
Set the start command
uvicorn for FastAPI; gunicorn for Django or Flask.
-
You
Connect the repo
Install the Runex GitHub App and pick the branch.
-
Runex
Build and serve
Isolated container with HTTPS.
Configuration
What start command should a Python app use?
Bind to 0.0.0.0 and the PORT variable. The Dockerfile makes it explicit.
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD uvicorn main:app --host 0.0.0.0 --port ${PORT:-8000}
# Django: gunicorn mysite.wsgi --bind 0.0.0.0:${PORT:-8000}
# Flask: gunicorn app:app --bind 0.0.0.0:${PORT:-8000}
Avoid
What goes wrong with Python deploys?
Dev servers and unpinned packages.
- Running flask run or manage.py runserver in production
- Unpinned dependencies that change between builds
- Django ALLOWED_HOSTS missing your *.runex.cloud or custom domain
- Database migrations never run after deploy
FAQ
Python deploy questions
Short answers for your first deploy.
Can I deploy FastAPI on Runex?
Yes. Run FastAPI with uvicorn bound to 0.0.0.0 and the PORT variable, and Runex serves it over HTTPS from an isolated container.
How do I deploy Django on Runex?
Serve Django with gunicorn, read DATABASE_URL and SECRET_KEY from environment variables, and add your Runex and custom domains to ALLOWED_HOSTS.
Which Python server should I use in production?
Use uvicorn for ASGI frameworks like FastAPI, and gunicorn for WSGI frameworks like Django and Flask. Never use the built-in dev server.
How do I run database migrations on Runex?
Run them as part of your start command, such as python manage.py migrate before gunicorn, or as a one-off job before switching traffic.
Next step
Deploy your Python app.
Connect your repo and get a live HTTPS URL on your first deploy. Free to start.
