Running Dash app with HttpPlatformHandler in Azure App Services Windows

Dash is a Open Source Python library for creating reactive, Web-based applications. Dash is a user interface library for creating analytical web applications.

You can find a Sample Python Dash project with above operations @ GitHub Link

Create Sample Project in local environment

  • Create app.py file with below content
import os

import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd

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

df = pd.read_csv('datafiles/SampleCSV.csv')


def generate_table(dataframe, max_rows=10):
    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        # Body
        [html.Tr([
            html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
        ]) for i in range(min(len(dataframe), max_rows))]
    )

app.layout = html.Div(children=[
    html.H4(children='US Agriculture Exports (2011)'),
    generate_table(df)
])

if __name__ == '__main__':
    app.run_server(debug=True)
    
  • Create SampleCSV.csv file under datafiles foder.

12

  • Create requirements.txt file with below content
dash==0.21.1
waitress==1.1.0
dash-core-components==0.23.0
dash-html-components==0.11.0
dash-renderer==0.13.0
plotly==2.7.0
numpy==1.14.5
pandas==0.23.1
  • Install dependencies listed in requirements.txt file using below command.
    c:\Tools\Python_3.6.6\python.exe -m pip install --upgrade -r requirements.txt
    3-1

  • Run app in local environment using below command

4-1

5-1
Create Azure WebApp and Use Site Extension to Upgrade Python

Navigate to Azure portal

  • Create an empty webApp on Azure

  • Once it is successful, search for “Extensions” in Azure portal
    6

  • Click on “Add”

7

  • Select any of the Python version from Extensions and click “ok” to apply the changes. In the Sample App I did selected “Python 3.6.4x 64”

8

For Creating and changing Deployment Script @link

  • Activate Deployment options as “Local Git Repository” and click Ok.

9

11

Ramya Gangula

Ramya Gangula

I work as Android developer at GM financials. Before GM i worked at Samsung. The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way

Read More