Running dash app in azure functions python model v2 but only getting default site up page

Dean MacGregor 6 Reputation points
2023-01-17T13:55:32.84+00:00

I'm using the v2 python programming model and trying to launch a dash app similar to the example of a Flask app here

my function_app.py is as follows:

import dash
from dash import dcc
from dash import html
import azure.functions as func


dashapp = dash.Dash()
colors = {
    'background': '#111111',
    'text': '#7FDBFF'
}
dashapp.layout = html.Div(
    style={'backgroundColor': colors['background']}, 
        children=[
            html.H1(
                children='Hello Dash',
                style={
                    'textAlign': 'center',
                    'color': colors['text']
                }
            ),
            html.Div(children='Dash: A web application framework for Python.', style={
                'textAlign': 'center',
                'color': colors['text']
            }),
            dcc.Graph(
                id='Graph1',
                figure={
                    'data': [
                        {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
                        {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
                    ],
                    'layout': {
                        'plot_bgcolor': colors['background'],
                        'paper_bgcolor': colors['background'],
                        'font': {
                            'color': colors['text']
                        }
                    }
                }
            )
    ]
   )

app = func.WsgiFunctionApp(app=dashapp.server.wsgi_app, 
                        http_auth_level=func.AuthLevel.ANONYMOUS)

My host.json is:

    {
    "version": "2.0",
    "logging": {
        "applicationInsights": {
        "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request"
        }
        }
    },
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[3.15.0, 4.0.0)"
    },
    "functionTimeout": "00:10:00",
    "extensions": 
    {
        "http": 
        {
            "routePrefix": ""
        }
    }
    }

When I run locally it works as expected with my app at http://localhost:7072/ but when I deploy to Azure functions and go to myapp.azurewebsites.net then I just get the your app is up and running page. My guess is that Azure is serving that at the root address regardless of my app but the local deployment doesn't but I don't know how to verify that or, more importantly, change that behavior.


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
{count} vote

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2023-01-24T08:55:25.4+00:00

    @Dean MacGregor

    Thanks for reaching out to Q&A forum.

    You should not hit the myapp.azurewebsites.net URL. It is the main site of the function app and it will show "Function is up and running" page all the time. Instead, you will have to launch the specific url of the function to which the code is deployed. Like below

    User's image

    Hope this helps! Feel free to reach out to me if you have any queries or concerns.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.