Dash - Multi-page App on Heroku 500 Internal Server Error

I have created an app almost identical in structure to the multi-page app design here:
https://dash.plot.ly/urls (under “Structuring a Multi-Page App”).

The app works perfectly when I run the index.py file. However, when I try running the app.py file, nothing occurs. Also, when I deploy this app to Heroku, I get an Internal Server Error that says:

The layout was None at the time that run_server was called. Make sure to set the layout attribute of your application before running the server.

I’m not sure if I need to point the app object in app.py to the index.py file, or if I need to make any other changes for deployment. The layout is set initially in index.py, so I’m guessing that the app may need to access index.py before the line ‘server=app.server’ in app.py.

1 Like

I have the same issue. Any update?

1 Like

Are you intending to run with the flask debug server? If you’re using gunicorn, you probably should be able to just update your Procfile. If it’s running on index.py in the root path, that means Procfile should read something like:

web: gunicorn index:app

1 Like

I’m facing the same issue. Any update on this?

@brad is right, you need to be using index.py as the entry point of your app, not app.py.

So you need to point gunicorn at index:app

1 Like