✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Dash & IIS Not Working Together

Folks,

I am completely new to trying to get a local web page running, so please keep this in mind when answering my question.

I am trying to get IIS to run a python script. I followed the tutorial in the link below.

At first I was getting some user security errors, but have since worked through them. Now, I am receiving an error of a bad gateway - “The specified CGI application misbehaved by not returning a complete set of HTTP headers. the headers it did return are”"." This leads me to believe my python code is causing the issue. But if I run my code in Spyder and type in 127.0.0.1:8050 into Chrome a page comes up. I am clearly missing something. Any ideas on where to start???

#Webpage Creation
app = dash.Dash()

app.layout = html.Div([

                       html.H1('PClean Output Data'),



                       #Table
                       dash_table.DataTable(
                                            id='table',
                                            columns=[{"name": i, "id": i} for i in df.columns],
                                            data=df.to_dict("rows"),
                                            editable=True,
                                            filtering=True,
                                            sorting=True,
                                            sorting_type='multi',
                                            n_fixed_rows=1,
                                            style_cell_conditional=[
                                                                     {'if':{'column_id':'Status'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Work Order'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Part Number'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Serial Numbers'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Quantity'},
                                                                     'width':'5%'},
                                                                     {'if':{'column_id':'Program'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Arrival Date'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Need Date'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Test Date'},
                                                                     'width':'10%'},
                                                                     {'if':{'column_id':'Test ID'},
                                                                     'width':'5%'},
                                                                     {'if':{'column_id':'Facility'},
                                                                     'width':'10%'}],
                                            style_table={
                                                         'maxHeight':'300',
                                                         'overflowY':'scroll',
                                                         'overflowX':'scroll'}
                                            ),
                        
                                            
                                            
                      
                        
                        
                        #Yearly Output by Pclean
                        html.Div([dcc.Graph(id='Year_Output',figure={
                                                                     'data':[go.Bar(
                                                                                    x=year_count.index,
                                                                                    y=year_count['Test ID'])
                                                                             ],
                                                                      'layout':go.Layout(
                                                                                         title='Yearly Output',
                                                                                         xaxis=dict(
                                                                                                    title='Date',
                                                                                                    tickvals = year_count.index),
                                                                                                    yaxis=dict(
                                                                                                               title='Verifications')
                                                                                                    )
                                                                    }
                                            )
                                    ]
                                ),

  
                        html.H3('PClean: Last Week'),                                                                            
                                                                                                    
                        html.Div([
                                  
                                  #Last Week's Output
                                  html.Div([
                                            dcc.Graph(id='LastWeekOutput',figure={
                                                                                  'data':[go.Bar(
                                                                                                 x=lw_count.index,
                                                                                                 y=lw_count['Test ID'])
                                                                                         ],
                                                                                  'layout':go.Layout(
                                                                                                     title= 'Pclean Output',
                                                                                                     xaxis=dict(
                                                                                                                title='Date',
                                                                                                                tickvals = lw_count.index),
                                                                                                     yaxis=dict(
                                                                                                                title='Verifications')
                                                                                                     )
                                                                                }
                                                        )
                                            ], className="six columns"),
                                     
                                      
                                      
                                  
                                  #Last Week's Programs
                                  html.Div([
                                            dcc.Graph(id='LastWeekPrograms', figure={
                                                                                     'data':[go.Pie(
                                                                                                    values=lw_prog['Test ID'],
                                                                                                    labels = lw_prog.index,
                                                                                                    name='Program',
                                                                                                    hoverinfo='label+percent+name',
                                                                                                    hole=.4)],
                                                                                     'layout':go.Layout(
                                                                                                        title='Program Support')
                                                                                     }
                                                      )
                                            ], className='six columns'
                                        ),
                                     ], className='row'),
                                                                                     
                                                                                     
                                                                                     
                            html.Div(id='table-container')
                ])

app.css.append_css({‘external_url’:‘https://codepen.io/chriddyp/pen/bWLwgP.css’})

#Pointless Callback to make table interact - literally does nothing.
@app.callback(
Output(‘table-container’, “children”),
[Input(‘table’, “derived_virtual_data”),
Input(‘table’, “derived_virtual_selected_rows”)])
def update_graph(rows, derived_virtual_selected_rows):
return html.Div([])

if name == ‘main’:
app.run_server(debug=True)

Cheers.
Rich

I think you need to specify how yout Dash app is served in your IIS.
A difference I see in your code compared to my own is that I have a line which specifies the server of my app.

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

I am not sure if this helps, I think I did it this way due to some WSGI handling of my app.