Black Lives Matter. Please consider donating to Black Girls Code today.
https://www.blackgirlscode.com

Dash Heroku Deployment H10 Error

I have been trying to deploy my first Dash App using Heroku but I keep getting the same H10 Error. I have seen some solutions online and on here but none of them have seemed to work

Code:
import pandas as pd

import dash_core_components as dcc

import dash_html_components as html

import plotly

import datetime

import plotly.graph_objs as go

from collections import deque

import pandas_datareader.data as web

import dash

app = dash.Dash(‘Student Loans Data’)

server = app.server

external_css = [“https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css”]

external_js = [‘https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js’]

app = dash.Dash(‘loansdata’,

            external_scripts=external_js,

            external_stylesheets=external_css)

df = pd.read_excel(r’…/dashapp/loans_sum.xlsx’)

app.layout = html.Div([

html.H1('Student Loans Data'),

dcc.Graph(id='loans',

          figure ={

              'data':[{'x': df['observation_date'],'y':df['SLOAS(Billions)'],'type':'line','name':'boats'}],

              'layout':{

                  'title':'Total Student Loans Trend'

                  

              }

          })

])

if name ==‘main’:

app.run_server(debug=True)

Error:
2020-06-30T03:06:58.111966+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=loans629.herokuapp.com request_id=92059f77-ea8c-4d68-b903-a7d86d842e00 fwd=“99.101.58.95” dyno= connect= service= status=503 bytes= protocol=https

2020-06-30T03:06:58.339593+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=loans629.herokuapp.com request_id=3364d0b5-2dcf-4dff-837e-03be51b6f468 fwd=“99.101.58.95” dyno= connect= service= status=503 bytes= protocol=https

Try adding this line, it worked for me
server.secret_key = os.environ.get(‘SECRET_KEY’, ‘my-secret-key’)

Hi @mcket747,
if @niharika412 solution doesn’t work for you, see if any of these articles help.



1 Like

I Niharika. Would I just add this to the bottom of the script for my app?

Yeah. Anywhere in the script

Where do you get the secret key from? I haven’t seen that term before?