# Deploying Dash app on a wsgi service

**URL:** <https://community.plotly.com/t/deploying-dash-app-on-a-wsgi-service/57867>\
**Category:** Dash Python\
**Created:** [October 24, 2021, 5:22pm UTC](https://community.plotly.com/t/deploying-dash-app-on-a-wsgi-service/57867 "2021-10-24T17:22:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erixlie](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@erixlie](https://community.plotly.com/u/erixlie)\
**Post date:** [October 24, 2021, 5:22pm UTC](https://community.plotly.com/t/deploying-dash-app-on-a-wsgi-service/57867/1 "2021-10-24T17:22:14Z")

</div>

Hey guys,

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

[https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps)

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

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

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

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash( __name__ ,external_stylesheets=external_stylesheets)

app.layout = html.Div([])

auth = dash_auth.BasicAuth(
    app,
    VALID_USERNAME_PASSWORD_PAIRS
)

@app.callback(
)
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__':
    app.run_server(debug=True)

```

and my flaskapp.wsgi file contains this:

```auto
#!/usr/bin/python4.8
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskApp/")

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

```

The error log says this:

```auto
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

---

<div class="post-metadata">

**Author:** ![erixlie](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@erixlie](https://community.plotly.com/u/erixlie)\
**Post date:** [October 24, 2021, 5:50pm UTC](https://community.plotly.com/t/deploying-dash-app-on-a-wsgi-service/57867/2 "2021-10-24T17:50:06Z")

</div>

Answering my own question:

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

```auto
from myapp import app
application = app.server

```

Taken from:  
[https://help.pythonanywhere.com/pages/DashWSGIConfig/](https://help.pythonanywhere.com/pages/DashWSGIConfig/)
