What is the correct `Start Command` for a Python Dash app?

Hello World!

Like many other people who are having to migrate from Heroku to other providers (:sob:), and I am having a hard time learning the “correct tricks” to get my application running on Render’s servers.

My application has basically 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 think the error is…) gunicorn app:app (on heroku I use web: gunicorn app:server).

After the deployment I get the following error:

AppImportError: Application object must be callable.

As far as I understand, Render cannot call the application. Why is this?

Other information that might help someone else to enlighten my path.

  • The name of the file containing the application is app.py (does this create a conflict?).
  • The version of python that I specify to Render is 3.8.0.

I think the ero is in the Start Command. Can anyone tell me what would be the right command for this application?

Thanks for your attention!

Hi Nicholas,

I hadn’t seen that error message before, but a bit of googling led me to this Stack Overflow post:


So it seems that your intution was right - that specific name “app” is causing a conflict inside Gunicorn. Could you try renaming it? Let us know whether that does the trick!

Got the solution!

I changed the name from app.py to my_app.py, and used the start command gunicorn my_app:server.

That does the trick! :hugs:

1 Like

So glad to hear it! Best of luck with your project :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.