Deploying Dash app on a wsgi service

Hey guys,

I am trying to deploy dash as a wsgi service, following similar steps as in the DigitalOcean tutorial:

This is my code (truncated the callback and layout sections):

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import as px
import dash_auth
import dash_enterprise_auth as auth

VALID_USERNAME_PASSWORD_PAIRS = [['hello', 'world']]

external_stylesheets = ['']
app = dash.Dash(__name__,external_stylesheets=external_stylesheets)

app.layout = html.Div([])

auth = dash_auth.BasicAuth(

def update_figure(n_clicks,state1,state2,state3):

    return fig, u'''The Button has been pressed {} times, Input 1 is "{}", and Input 2 is "{}"'''.format(n_clicks, state1, state2)

if __name__ == '__main__':

and my flaskapp.wsgi file contains this:

import sys
import logging

from FlaskApp import app as application
#from FlaskApp import server as application
#application.secret_key = 'xx'

The error log says this:

TypeError: 'Dash' object is not callable

I suspect the exact same mechanics don’t work for Dash as for Flask (I’ve literally applied the same construction of the wsgi file from the flask tutorial to this), but can’t really figure out how to modify it to get it to work

Answering my own question:

Modified wsgi file to include the below - and everything now works

from myapp import app
application = app.server

Taken from:

1 Like