App hosting ยท Flask

Flask hosting that starts from a template

Fork the Flask API starter or push your own repository, set the start command, give the app an address. Python is detected from requirements.txt and the app redeploys on every push.

Free app
256 MB, Node.js, Python, Go, Java and more
Address
https://name.fadehost.app, sleeps when idle on free
Paid
from $2/mo or $20/yr for 1 GB, with an always-on address included
Regions
France, Montreal, Oregon, Singapore

What the repository needs

  1. requirements.txt with flask and, for production, gunicorn.
  2. A start command: gunicorn -b 0.0.0.0:$PORT app:app. The development server (app.run) also works with host="0.0.0.0" and port=int(os.environ.get("PORT", 8080)), it is just slower.
  3. Secrets in environment variables.

The flask-api-starter template has all of this plus a health route, JSON errors and tests; pick it in the panel and it deploys in one step.

SQLite, uploads and other files

Point SQLAlchemy at sqlite:////data/app.db and uploads at a folder under /data: that path survives redeploys. When one file is not enough, a managed PostgreSQL is one click away.

Templates, static files and a domain

Jinja templates and the static folder ship with the repository and are served by Flask as usual. The app's address is https and behind a proxy, so ProxyFix keeps request.remote_addr and url_for honest. Your own domain points at the app from its page.

Frequently asked questions

Flask or FastAPI?

Both deploy the same way. Flask is synchronous and has the larger ecosystem of extensions; FastAPI is async with typed models. The starter templates exist for both.

Which port does the app listen on?

The PORT environment variable, 8080 by default, on 0.0.0.0. A server bound to 127.0.0.1 answers only itself and the web address gets nothing.

How does the public address work?

Give the app a web address in the panel and it is served at https://name.fadehost.app behind the Cloudflare proxy with a certificate. It comes with the plan on every tier. On the free tier the address sleeps when nobody has used it for a while and wakes on the next request; on a paid tier it stays awake. Your own domain can point at it.

What happens on a deploy?

The repository is cloned at your branch, dependencies install, the build runs when there is one, the app starts. With auto-deploy on, every push does the same. The live console shows each step; a failed one is explained in plain words.

Where do files and databases live?

Files written under /data survive redeploys; everything else is rebuilt from the repository. Every paid app includes a one-click MySQL database; PostgreSQL, MongoDB and Redis are managed databases on the same private network, never on the public internet.

Related

Flask hosting that starts from a template

Deploy a Flask app free