Deploy a Python App for Free: Flask, FastAPI & Django
Python web frameworks make building APIs a joy — and then deployment tutorials throw you into a swamp of gunicorn configs, systemd units and reverse proxies. It doesn't have to be that way. Here's how to take a Flask, FastAPI or Django app from a GitHub repository to a live HTTPS URL in minutes, for free.
The three rules of deployable Python apps
Whatever the framework, a cloud platform needs the same three things:
- A
requirements.txtat the repo root listing every dependency (including your production server:gunicornoruvicorn). - A start command that binds to
0.0.0.0and reads$PORT. - Configuration from environment variables — secrets never live in the repo.
Flask
# requirements.txt
flask
gunicorn
# start command
gunicorn app:app --bind 0.0.0.0:$PORTWhere app:app is module:variable — if your file is server.py with application = Flask(__name__), use server:application.
FastAPI
# requirements.txt
fastapi
uvicorn
# start command
uvicorn main:app --host 0.0.0.0 --port $PORTFastAPI's automatic docs at /docs work out of the box once deployed — handy for sharing an API with teammates or an interviewer.
Django
# requirements.txt
django
gunicorn
whitenoise
# start command
gunicorn myproject.wsgi --bind 0.0.0.0:$PORTAdd whitenoise to serve static files, set ALLOWED_HOSTS = ["*"] (or your domain), and read SECRET_KEY and DEBUG from env vars.
Deploying on Abasthan
In the dashboard: Create App → Web Service, connect the repository, pick Python 3.10, 3.11 or 3.12, paste your start command, and choose the Free plan — your first app is $0, no credit card. The build streams live; a couple of minutes later your app is up at your-app.abasthan.app with SSL.
Need a database? Spin up managed PostgreSQL in one click and drop the connection string into environment variables as DATABASE_URL. Redis for Celery or caching is equally one click. Background workers and scheduled jobs deploy the same way — pick Background Worker or Cron Job instead of Web Service, from the same repo.
Common gotchas
- "Application failed to bind": you bound to
127.0.0.1or a hardcoded port. Always0.0.0.0:$PORT. - ModuleNotFoundError in production: the package is installed locally but missing from
requirements.txt. Runpip freeze > requirements.txtin a clean virtualenv. - Django static files 404: missing whitenoise, or
collectstaticdidn't run — add it to your build settings.
FAQ
Is free Python hosting really free, or a trial?
It's a real free tier: every account's first app runs at $0 with a free subdomain and SSL. Paid plans start at $2/month with per-second billing when you need more headroom.
Flask vs FastAPI for a new project?
FastAPI for APIs (async, validation, auto docs), Flask for simplicity and its huge extension ecosystem. Both deploy identically here.
Can I run Celery workers?
Yes — deploy the same repo as a Background Worker with your celery -A app worker command, and point it at a one-click Redis instance.
Ship your Python app today
Flask, FastAPI or Django — connect the repo, choose Free, and get a live HTTPS URL in minutes. Managed Postgres and Redis one click away.
Deploy Free