Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Deprecation Warning in Flask 2.2 (before_first_request) #2177

Closed
RobertJN64 opened this issue Aug 2, 2022 · 1 comment
Closed

[BUG] Deprecation Warning in Flask 2.2 (before_first_request) #2177

RobertJN64 opened this issue Aug 2, 2022 · 1 comment

Comments

@RobertJN64
Copy link

RobertJN64 commented Aug 2, 2022

The new release of Flask 2.2 deprecates the before_first_request method, which results in a warning upon app creation.

dash 2.6.0
flask 2.2.0

Full stack trace:

MLVisualizationTools/dashbackend.py:79: in getDashApp
      app = Dash(__name__, title=title, external_stylesheets=[theme], assets_folder=folder)
  .tox/py38/lib/python3.8/site-packages/dash/dash.py:501: in __init__
      self.init_app()
  .tox/py38/lib/python3.8/site-packages/dash/dash.py:545: in init_app
      self.server.before_first_request(self._setup_server)
  .tox/py38/lib/python3.8/site-packages/flask/scaffold.py:[49](https://github.com/RobertJN64/MLVisualizationTools/runs/7633737039?check_suite_focus=true#step:5:50): in wrapper_func
      return f(self, *args, **kwargs)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
  self = <Flask 'MLVisualizationTools.dashbackend'>
  f = <bound method Dash._setup_server of <dash.dash.Dash object at 0x7f27a07a00[70](https://github.com/RobertJN64/MLVisualizationTools/runs/7633737039?check_suite_focus=true#step:5:71)>>
  
      @setupmethod
      def before_first_request(self, f: T_before_first_request) -> T_before_first_request:
          """Registers a function to be run before the first request to this
          instance of the application.
      
          The function will be called without any arguments and its return
          value is ignored.
      
          .. deprecated:: 2.2
              Will be removed in Flask 2.3. Run setup code when creating
              the application instead.
      
          .. versionadded:: 0.8
          """
          import warnings
      
  >       warnings.warn(
              "'before_first_request' is deprecated and will be removed"
              " in Flask 2.3. Run setup code while creating the"
              " application instead.",
              DeprecationWarning,
              stacklevel=2,
          )
  E       DeprecationWarning: 'before_first_request' is deprecated and will be removed in Flask 2.3. Run setup code while creating the application instead.
@RobertJN64
Copy link
Author

I am going to mark this as closed because it is fixed in the plotly:dev branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant