Shipzo / Guides / Python · Flask

How to deploy a Flask app for free

Python · Flask8 min readUpdated 25 October 2026

You built a Flask app that works on localhost:5000. This guide gets it onto the internet with a real HTTPS link you can share, in about ten minutes, without paying anything.

Quick answer
  1. Bind to 0.0.0.0 and read the port from the PORT environment variable.
  2. List every package in requirements.txt (add gunicorn for production).
  3. Push the code to GitHub.
  4. Paste the repo link into Shipzo and press Deploy. You get https://your-app.shipzo.tech.

What you need

Step 1: Make your app ready for a server

On your laptop, Flask's development server listens on 127.0.0.1:5000. A hosting server tells your app which port to use through an environment variable called PORT, and it must listen on all network interfaces (0.0.0.0), not just localhost. Change the bottom of your main file like this:

app.py

import os
from flask import Flask, render_template

app = Flask(__name__)

@app.route("/")
def home():
    return render_template("index.html")

@app.route("/health")
def health():
    return {"status": "ok"}

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5000))
    app.run(host="0.0.0.0", port=port)

Keep the Flask object named app and the file named app.py (or main.py). Most hosts, Shipzo included, look for exactly that.

Write requirements.txt

The server installs only what is listed here. If you installed something with pip install and forgot to list it, the deploy fails with ModuleNotFoundError.

requirements.txt

Flask>=3.0,<4
gunicorn>=22

To capture everything your project uses, run pip freeze > requirements.txt inside your virtual environment, then delete lines you don't need.

Why gunicorn? Flask's built-in server is for development only: it handles one request at a time and isn't hardened. In production you run a WSGI server such as gunicorn: gunicorn app:app --bind 0.0.0.0:$PORT --workers 2. Gunicorn doesn't run on Windows, so keep using python app.py locally.

Add a .gitignore

.gitignore

venv/
.venv/
__pycache__/
*.pyc
.env

Never commit .env files, passwords or API keys. You'll add secrets as environment variables on the server instead.

Step 2: Push your code to GitHub

Create an empty repository on GitHub, then run these commands in your project folder:

git init
git add .
git commit -m "First version"
git branch -M main
git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git
git push -u origin main

Step 3: Deploy it

  1. Create a free Shipzo account and open New deployment.
  2. Paste your repository link, for example https://github.com/you/flask-app.
  3. Pick the Starter plan (enough for most Flask apps) and press Deploy.

Here's what happens automatically, in order:

StageWhat it does
Fetch sourceClones your repo
Detect & scanSees requirements.txt and a Flask app, and checks for committed secrets
Automated testsRuns pytest if you have test_*.py files. Failing tests stop the deploy
BuildBuilds a Docker image with Python 3.12 and gunicorn
Deploy & health checkStarts the container and waits for GET / to answer
Go liveYour app is at https://your-app.shipzo.tech with HTTPS

Step 4: Updating your app

Just push again. Shipzo checks your branch every minute and redeploys new commits with zero downtime. If the new version fails its tests or health check, the old one keeps running.

git add .
git commit -m "Add contact page"
git push

Databases and secrets

Don't rely on a SQLite file for real data: every deploy starts from a clean container, so the file resets. Use a free hosted database such as Neon or Supabase (PostgreSQL) or MongoDB Atlas, and pass the connection string as an environment variable:

import os
DATABASE_URL = os.environ["DATABASE_URL"]

In Shipzo, open your project → Settings → Environment variables and add DATABASE_URL=.... Values are injected at runtime and masked in every log.

Common errors and fixes

ErrorFix
ModuleNotFoundError: No module named 'x'Add the package to requirements.txt and push again.
Health check timed outYour app listens on 127.0.0.1 or a fixed port. Use host="0.0.0.0" and the PORT variable.
App exits during start-upRead the last lines in the build log. Usually a missing environment variable or a crash at import time.
TemplateNotFoundLinux is case-sensitive: Templates/ is not templates/, and Index.html is not index.html.
Can't find the app objectName it app = Flask(__name__) in app.py, or set a custom start command in Settings.

Deploy it in one click

Paste your GitHub repo into Shipzo. Tests, Docker build, HTTPS and monitoring are handled for you. Free during the beta, no card needed.

Create a free account

Frequently asked questions

Is it really free?

Yes. Shipzo is free during the beta, with up to 3 projects per account and no card required.

Does my Flask app go to sleep when nobody visits?

No. Apps on Shipzo keep running, so the first visitor after a quiet hour doesn't wait for a cold start.

Can I deploy Django or FastAPI the same way?

Yes. Shipzo detects Django from manage.py and FastAPI from requirements.txt, and starts them with gunicorn or uvicorn.

Can I use my own domain?

During the beta every app gets a free HTTPS subdomain on shipzo.tech. Custom domains are on the roadmap.