Flask decorators

Hello, I have been trying dash this last week and I think you have made a really awesome product :slight_smile:

However, after trying a lot I haven’t been able to get typical flask app decorators to work with Dash, since Dash runs on Flask, I thought it would be possible to use decorators such as (at)before_first_request or (at)after_request,

When I try it with a pure Dash app, the code won’t even run since there isn’t such a decorator, but when I define for example:

server = flask.Flask(name)
app = dash.Dash(name, server=server)

I am able to define the following function, and run the code without issues:

def parse_request():
print ‘a’

However, this function iteself never executes, so I am getting no output.

I would like to know if this is normal behaviour or what I should do to get such decorators to work.

Thanks in advance!

bear in mind i am using (at) instead of@ because the forum thought I was referencing other users and wouldn’t let me post otherwise :smile:

Hm, I’m not sure why that isn’t working. We do something similar in the Dash code itself (and it works): https://github.com/plotly/dash/blob/master/dash/dash.py#L127


The question was posted some time ago, I wanted to almost the same thing. Only from within Dash.

Do not know if this helps, but here is the code:

def print_something():