Uploading Dash App in Heroku gives an

Hello, I am working on my dash app for my master’s final project and now I have a new problem I hope someone can help me with. I was recently able to upload a simple app in heroku without issues. The app had only one .py file. Now I have added some tabs to the app and therefore added complexity and additional files to it. It works fine locally in my Mac laptop. But when I try to create the app and upload it in Heroku it does not work. I think I know why it does not work but I don’t know how to fix it. While putting together the tabs in my dashboard using the Dash library, I had to create a file named dash_app.py in addition to the index.py file. The file dash_app.py has the following code:

import dash
import dash_bootstrap_components as dbc

external_stylesheets = [dbc.themes.BOOTSTRAP]

app = dash.Dash(__name__,external_stylesheets=external_stylesheets)
server = app.server

Notice how I have included HERE (and not in the index.py) the line: server = app.server

Having said the previous, the code for the index.py is included below. This file basically allows me to define the tabs I need in my dashboard. This was the only way it would work, otherwise, if I had everything in one file, i.e. index.py, the tabs would show but they would not work (in fact it would not show the contents associated with each tab). Here is the code for the index.py file:

import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import my_callbacks
import dash_app

#app = dash.Dash() - I had to comment this line because of the issue mentioned before

dash_app.app.config['suppress_callback_exceptions'] = True

dash_app.app.layout = html.Div([
							    html.H1('Real State Prediction Web'),
							    dcc.Tabs(id="tabs-master", value='Description', children=[
							        dcc.Tab(label='Introduction', value='Introduction'),
							        dcc.Tab(label='Gallery', value='gallery'),
							        dcc.Tab(label='Reporting', value='Reporting'),
							        dcc.Tab(label='Analysis', value='Analysis')

if _name_ == '__main__':

So, to run the app locally I type in the terminal “python index.py” and it runs without a problem in Safari or Chrome… but I know the “Procfile” that needs to be created has to have in the top the name of the file where the code “server = app.server” was included. Whether I type “index” or “dash_app” (without the .py), it won’t work. If you have any idea as of why this it, please let me know… I am stuck in this part and can’t move forward (plus I am new to all this!!!)

Thank you, any feedback will be extremely valuable.


Your Procfile content should be something like

web: gunicorn --workers=1 --threads=1 dash_app:server

What is the content now?

web: gunicorn dash_app:server

I made the change and included web: gunicorn --workers=1 --threads=1 dash_app:server in the Procfile and it did not work.

I was also the “dash_app:server” server that was the important part, so your Procfile looks OK as it is. What is the error that you get?

1 Like

This is the error that I am getting:

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

If someone can help me figure this out, that would be amazing… I am stuck with this and can’t move forward…
Thank you!!!

Jorge, can you post your files and folders (the whole project) onto GitHube. It would take help to look at the full code and the file structure and the spelling (for example, if procfile does not have a capital P, it doesn’t work)

Hi Adam!

Here is the Github URL for this project. Thank you so much for offering your help… I am completely at a loss to find a solution.

No worries.
Where is your Procfile?
And how big would you say is the whole project? I know Heroku free account has a limit of 500mb

Wow, that was so quick, thank you Adam for the quick reply and desire to help. Yes, putting all in the index.py file is an option but that would probably be a bit complicated at this point… we (my team) were following some recommendations we found online in terms of how to structure the app using different .py files for different things (tabs, for example) so that it can be easier to follow the code and better structured overall. I have a feeling that the solution is probably not too complicated, but as with most things in life, it is knowing that tiny missing detail that will get it to work…

Thank you for your help, I will see if I can find something else wrong with it, there isn’t tons of info online for this, so I was very glad to find your videos in youTube, a true blessing.


BTW: Here are the contents of the Procfile (with capital “P”):

web: gunicorn dash_app:server

@eurojourney Have you found the solution? I’m also stuck in this issue. Please help me if you got something