EthioDeploy
DocsPricingDomainsBlogToolsChangelog
Deploy guides/Python

Deploy a Python app

FastAPI, Flask and Django deploy from requirements.txt or pyproject.toml. Set a start command that binds 0.0.0.0:$PORT, and for Django, add the domain to your settings.

Last updated September 29, 2026

What we run by default
Detected by
requirements.txt, pyproject.toml, Pipfile or main.py
Install
pip install -r requirements.txt (or poetry / uv / pdm)
Build
none by default
Start
Django: migrate + gunicorn. Others: python main.py

These run automatically, so leave the command fields blank. Only override them in Settings → Build if you need something different.

Fix this first: Set a start command that binds 0.0.0.0:$PORT

Only Django gets a start command automatically. For FastAPI and Flask, set the Start command in Settings → Build so the server binds 0.0.0.0 on $PORT. A server on 127.0.0.1 or a fixed port fails the health check.

Prepare your app

List your dependencies in requirements.txt or pyproject.toml (Poetry, uv and PDM work too). We install them into an isolated environment. To pin the Python version, add a .python-version file or set the env var NIXPACKS_PYTHON_VERSION.

FastAPI

uvicorn app.main:app --host 0.0.0.0 --port $PORT --proxy-headers

Flask

gunicorn -b 0.0.0.0:$PORT app:app

Django

Django is detected via manage.py and starts with python manage.py migrate && gunicorn <project>.wsgi automatically. Add gunicorn to your requirements. Then update settings.py for production:

import os

SECRET_KEY = os.environ["SECRET_KEY"]
DEBUG = False
ALLOWED_HOSTS = ["<project-slug>.ethiodeploy.app", "yourdomain.com"]
CSRF_TRUSTED_ORIGINS = ["https://<project-slug>.ethiodeploy.app"]
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
STATIC_ROOT = BASE_DIR / "staticfiles"

CSRF_TRUSTED_ORIGINS entries must include the https:// scheme. Nothing runs collectstatic for you: set the Build command to python manage.py collectstatic --noinput and serve files with WhiteNoise (add it to MIDDLEWARE right after SecurityMiddleware).

Environment variables

Add variables in the project's settings. They're available both while the app builds and while it runs, so build-time values (like framework-public keys) work without extra setup. See Environment variables. Read them with os.environ["NAME"]. Set SECRET_KEY for Django.

Add a database

Add a Postgres addon and DATABASE_URL is injected automatically.

# Django (pip install dj-database-url)
import dj_database_url
DATABASES = {"default": dj_database_url.config(conn_max_age=600)}

# SQLAlchemy 2.x rejects the postgres:// scheme, so rewrite it
url = os.environ["DATABASE_URL"].replace("postgres://", "postgresql+psycopg://", 1)
engine = create_engine(url)

Framework-specific guides go further: Django, FastAPI and Flask.

Django runs migrate on every start, which is fine for a single instance. For Alembic, run alembic upgrade head before your server command, for example alembic upgrade head && uvicorn ….

Deploy

  1. Sign in with GitHub and install the EthioDeploy app on the repo.
  2. Click “New Project” and pick the repo.
  3. Watch the build in the dashboard. When the health check passes, your app is live at <project-slug>.ethiodeploy.app. Every push to the default branch redeploys, and the old version keeps serving until the new one is healthy.

Troubleshooting

App exits immediately or the health check fails+

Cause: No start command, or the server binds 127.0.0.1 / a fixed port.

Fix: Set the Start command to bind 0.0.0.0:$PORT.

Django: DisallowedHost (400)+

Cause: Your domain isn't in ALLOWED_HOSTS.

Fix: Add both the ethiodeploy.com subdomain and any custom domain.

Django: CSRF verification failed (403)+

Cause: CSRF_TRUSTED_ORIGINS is missing the https origin, or the proxy header isn't trusted.

Fix: Add the full https://… origin and set SECURE_PROXY_SSL_HEADER.

Django admin has no styling+

Cause: collectstatic never ran and nothing serves the files.

Fix: Run collectstatic in the Build command and add WhiteNoise.

Build fails installing a package (psycopg, Pillow…)+

Cause: The package needs system libraries or a pinned Python version.

Fix: Use psycopg[binary], or set NIXPACKS_APT_PKGS for the libs you need.

Wrong Python version+

Cause: The default Python doesn't match your app.

Fix: Add .python-version or set NIXPACKS_PYTHON_VERSION.

Still stuck? Check the deployment's build log in the dashboard, or see Troubleshooting.

Questions

Yes. The Free plan runs one project with a 512 MB Postgres database at no cost. The app sleeps after 30 minutes without traffic and wakes on the next request, and the container has 256 MB of memory. Pro ($10/month) keeps it always on with 1 GB.

No. Dependencies are installed from requirements.txt, pyproject.toml (Poetry, uv or PDM) or Pipfile. Django starts automatically; for FastAPI and Flask, set a start command that binds 0.0.0.0:$PORT.

Add a .python-version file, or set the NIXPACKS_PYTHON_VERSION env var, to pick the version. A runtime.txt file from Heroku is not read.

Ready to deploy?

Sign in with GitHub and pick your repo. No Dockerfile, no YAML.

More guides

SvelteKitTanStack StartAstro

All guides on the deploy guides page. Custom domains, env vars, addons and billing are in the docs.

On this page
Prepare your appEnvironment variablesAdd a databaseDeployTroubleshootingQuestions
Deploying with an agent?Point it at llms.txt. Every guide is in one file there.Open llms-full.txt →
EthioDeploy

Agentic first development and deployment, started in Ethiopia, built for developers everywhere.

Telegram community
Product
PricingAI coding agentAgent mode docsDomainsCLIFree backend hostingHosting in EthiopiaChangelog
Deploy guides
Next.jsNode.jsPythonSvelteKitTanStack StartAstroNuxtReact RouterHonoStrapiDjangoFastAPIFlaskStreamlitExpressNestJSLaravelRailsGoTelegram botDiscord botLovableBoltReplitv0Google AI StudioBase44Firebase StudioClaude Code & Cursor
Compare
vs Herokuvs Vercelvs Rendervs Railwayvs Fly.iovs Netlifyvs KoyebHeroku alternativesVercel alternativesNetlify alternativesRender alternativesRailway alternativesFly.io alternativesReplit alternativesPythonAnywhere alternativesDigitalOcean App Platform alternativesGlitch alternatives
Resources
DocsBlogFree toolsAboutSupportContactllms.txt
© 2026 EthioDeployPay by card in USD or bank transfer in ETBTermsPrivacy