Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Dash in IIS using Flask server?

I have added a Dash website to my development environment (Windows 2008 R2 and IIS - and no I don’t have any choice about this). My question is - does the method I am using use the Flask development server, and if so, is there a better way to deliver the content? I have read that the Flask server should not be used in deployment environments (If the answer seems obvious to you, I am just learning about Flask and Dash):

import flask
from datetime import datetime as dt
import dash
import dash_html_components as html
import dash_core_components as dcc

server = flask.Flask(__name__)

external_stylesheets = ['']

app = dash.Dash(__name__, server=server, external_stylesheets=external_stylesheets)
app.layout = html.Div([
        html.H3(children='Pick a Date'),

        min_date_allowed=dt(2018, 1, 1),,,

    dash.dependencies.Output('output-container-date-picker-single', 'children'),
    [dash.dependencies.Input('my-date-picker-single', 'date')])
def update_output(date):
    string_prefix = 'You have selected: '
    if date is not None:
        date = dt.strptime(date, '%Y-%m-%d')
        date_string = date.strftime('%B %d, %Y')
        return string_prefix + date_string
    if len(string_prefix) == len('You have selected: '):
        return 'Select a date to see it displayed here'

if __name__ == '__main__':

I think you can use waitress to serve in production under Win.

You just need to add server = app.server in and create a file that looks like this:

from waitress import serve

from app import server


then you just call python instead of from command line.

Thank you, I will try your suggestion next week!

This was a great help, thank you!
I have now removed all Flask from my IIS deployed apps, which are now using waitress. :slight_smile:

My initial impression is that my app should operate faster now, but I need to run some tests before I can conclude anything definitive. :man_technologist:

I have tried you suggestion and it seems to be working - this is exactly what I was looking for, Thank You!