Sahel Escale

How to Deploy a Flask App Online for Free

You built a Flask app that works on your computer. Now you want other people to use it. Here is a simple, free way to put it online.

Before you start

Free plans change over time and have limits (for example, a free app may go to sleep after a period without visitors), so check the current terms on the hosting site.

Step 1: Prepare your project

Your project folder should look like this:

my-app/
  app.py
  requirements.txt
  templates/
  static/

Here is a minimal app.py:

from flask import Flask

app = Flask(__name__)

@app.route("/")
def home():
    return "Hello from my Flask app!"

Step 2: List your dependencies

Create a file called requirements.txt that names every package your app needs. At minimum:

flask
gunicorn

Gunicorn is the production server that will run your app online. Flask's built-in server is only for testing on your computer.

Step 3: Upload your project to GitHub

  1. Create a new repository on GitHub.
  2. Upload your project files to it (you can drag and drop them in the browser).
  3. Do not upload passwords or secret keys. Keep those out of your code.

Step 4: Create the service on Render

  1. Sign up on Render and connect your GitHub account.
  2. Choose New, then Web Service, and select your repository.
  3. Set the Build Command to pip install -r requirements.txt
  4. Set the Start Command to gunicorn app:app
  5. Pick the free instance type and click deploy.

The part app:app means: the file app.py, and the variable named app inside it. If your file or variable has another name, change it here.

Step 5: Open your app

After a few minutes, Render shows a public link for your app. Open it in your browser and share it with a friend.

Common problems

A free alternative

PythonAnywhere also offers a free plan that is friendly to beginners and made for Python web apps. It is a good option if you prefer a simple control panel to a GitHub-based setup.

Final thoughts

Deploying your first app feels hard until you do it once. Start with a tiny project, get it online, and improve it from there.

← Back to all guides