Migrating from Heroku: How to use Render to deploy a Python Dash app (Solution)

Hello World!

Like many other people who are having to migrate from Heroku to other providers (:pleading_face:), I found Render’s servers as a free hosting option.

After brute-forcing a bunch, I found the setting to allow one to deploy a Python Dash app on Render.

My test application has this skeleton:

import dash
import dash_auth
import dash_bootstrap_components as dbc
from dash import dcc, html, Output, Input, State, dash_table

app = dash.Dash(__name__,
                    {'name': 'viewport', 'content': 'width=device-width, initial-scale=1.0, maximum-scale=1.2, minimum-scale=0.5,'}],

server = app.server
app.title = 'Title'
app.layout = dbc.Container(fluid=True, children=[])

    [Output('some_stuff', 'children'),],
    [Input('stuff', 'value')])

def display_something(value):
    return value

if __name__ == '__main__':

The source code is in a private repository on Github (assets folder, requirements.txt, gitignore, the whole thing). So:

  • I connect the repository to Render as a Web Service;
  • use the Build Command = pip install --upgrade pip setuptools wheel && pip install -r requirements.txt (I was getting errors because of the old pip version, so I am updating it).
  • and use the Start Command (and here is where I got so many failed deploys…) gunicorn my_app:server.

And It works!

Other information that can help someone else replicate this result.

  • The name of the file containing the application is my_app.py.
  • The version of python that I specify to Render is 3.8.0 (in Render, you specify this as an environmental variable during deployment, directly on Render’s dashboard).

Hope this helps people in a similar situation as me!

Thanks for your attention! :hugs:


Hi and many thanks for your post!

I have just tried to deploy my Dash app to Render for the first time following your steps. However I receive the below error message during deployment, seemingly after installing the requirements - “bash: gunicorn: command not found”. The only difference to your steps was I am using Python 3.11.4.

Would you have any ideas?

Many thanks !

I managed to find the solution, I needed to add gunicorn to my requirements.txt:

I didn’t need this line in my requirements to run my app locally or on pythonanywhere. Many thanks again for your very helpful post!

1 Like