rmountjoy92 / DashMachine

Another web application bookmark dashboard, with fun features.
GNU General Public License v3.0
1.24k stars 119 forks source link

Add support for Flask-sqlalchemy 3.x #232

Open dartie opened 2 years ago

dartie commented 2 years ago

Flask-sqlalchemy 3.x causes the following error at the start:

$ python run.py 
Traceback (most recent call last):
  File "run.py", line 20, in <module>
    dashmachine_init()
  File "/home/username/Apps/DashMachine/dashmachine/main/utils.py", line 35, in dashmachine_init
    db.create_all()
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 868, in create_all
    self._call_for_binds(bind_key, "create_all")
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 839, in _call_for_binds
    engine = self.engines[key]
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/flask_sqlalchemy/extension.py", line 628, in engines
    app = current_app._get_current_object()  # type: ignore[attr-defined]
  File "/home/username/Apps/DashMachine/venv-DashMachine/lib/python3.8/site-packages/werkzeug/local.py", line 513, in _get_current_object
    raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.

The workaround is installing 2.5.1 instead.

Request: add support for Flask-sqlalchemy 3.x