Skip to content

Working outside of request context. #465

Open
@mb7419

Description

@mb7419

I upgraded my server to latest ubuntu 24 and python 3.12 and latest Flask from earlier where I was using Flask 1.1.1 on ubuntu 18 with Flask_monitoringdashboard 3.1.0. I upgraded Flask_monitoringdashboard to 3.1.2 to fixe issues owing to changes in flask2 onwards (as noted on the release notes).

My flask app is working fine , however flask_monitoring dashboard does not commit any thing to the database (MySQL). I get the following error from database/_init.py (session_scope()) in my apache logs

"No commit has been made, due to the following error: Working outside of request context." .

The configuration file I am using is given below. Any help or suggestions to fix this ?

[dashboard]
APP_VERSION=1.0
GIT=//.git/
CUSTOM_LINK=dashboard
MONITOR_LEVEL=1
OUTLIER_DETECTION_CONSTANT=2.5
SAMPLING_PERIOD=20
ENABLE_LOGGING=True

[authentication]
USERNAME=admin
PASSWORD=xxxx
SECURITY_TOKEN=xxxxx

[database]
TABLE_PREFIX=fmd
DATABASE=mysql://fmd:xxxx@localhost/fmd

[visualization]
TIMEZONE=Asia/Kolkata

Looking for hints to fix this. Given the error tempted to change code in passing the Flask app context in session_scope() explicitly, however not sure of this approach and if I maybe doing anything else wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions