Blog
2026-07-20
How to host a Python project online (Flask or FastAPI)
Python web projects are mostly Flask or FastAPI, and both go online the same way: install the dependencies and run the app. The database is the part students usually get stuck on, which is why DormHost puts one on the same machine.
Flask and FastAPI deploy the same way. The only difference is the command that starts the server, and both have to bind the port the platform hands them rather than a port they choose.
Step by step
- Commit requirements.txt or pyproject.toml. The build installs from it, so anything missing there is missing in production.
- Bind to 0.0.0.0 and the PORT variable: uvicorn main:app --host 0.0.0.0 --port $PORT for FastAPI, gunicorn app:app --bind 0.0.0.0:$PORT for Flask.
- Sign in to the dashboard with GitHub, press New app, name it, and pick Nap. Awake is for bots, scrapers and scheduled work.
- Paste the repository URL and branch, then press Create and deploy. Live logs shows the pip install and the start command as they run.
- Open Database, choose PostgreSQL, and press Add a database. It arrives as DATABASE_URL with pgvector already enabled, which is what an embeddings project needs.
- Open Environment for your API keys and read them with os.environ. Saving restarts the app.
- If the app crashes at start, the traceback is in Live logs. It is almost always a missing dependency or a port that was not read from PORT.
Every step above is a control that exists in the dashboard today. The docs go further: custom domains, backups, rolling back a bad deploy, and what to read when a build fails.
Ready to try it? Sign in with GitHub and put 30 days of DormHost credit in your balance, no card required. Hosting is ₹99 a month on Nap afterwards.