Hosting Your App on Render

There are various places that you can host a Flask app, but many are paid-only. One service that will host a simple Flask app for free is Render

Render makes hosting very simple:

Create an Account at Render

  1. Go to Render and Sign in with GitHub
  2. Sign up for the Hobby ($0) plan

Deploying Your App

Create the Web App

  1. Create a new Web Service
  2. To see your list of GitHub repos, you will need to add credentials so that Render has access to your repos.
  3. Select the project repo

Configure the Web App

  1. In the deployment settings, set the following:

    • Name: Can customise if you wish
    • Language: Python 3
    • Branch: main
    • Region: Singapore
    • Root Directory: Leave blank
    • Build Command: pip install -r requirements.txt
    • Start Command: flask run
    • Instance Type: Free
    • Environment Variables (copy/paste from your .env file to start):
      • FLASK_SECRET_KEY Something long and random
      • DEFAULT_TIMEZONE Pacific/Auckland
      • LOCAL_DB_PATH app/db/data.sqlite
      • FLASK_RUN_HOST 0.0.0.0
      • FLASK_RUN_PORT 10000
      • FLASK_DEBUG False
      • Any other vars required, e.g. ADMIN_PASSWORD
  2. Deploy the web service, and it should be good to go!

Access the Deployed App

In the Render dashboard:

Updating the Deployed App

Every time you push changes to your GitHub repo, Render will automatically re-deploy the app - there is nothing you need to do.

Limits of Free Hosting on Render

The free service has some limitations:

These limitations are fine for a ‘toy app’, but you would need to look at different hosting if you needed to retain database updates.