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

Replace current_app with create_app to provide app_context. #5852

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

Aadesh-Baral
Copy link
Contributor

closes #5843

@Aadesh-Baral Aadesh-Baral changed the title Fix/5843 app context Replace current_app with create_app to provide app_context. May 31, 2023
@Aadesh-Baral Aadesh-Baral changed the title Replace current_app with create_app to provide app_context. Replace current_app with create_app to provide app_context. May 31, 2023
@Aadesh-Baral Aadesh-Baral force-pushed the fix/5843-app-context branch 3 times, most recently from 5d68281 to 8d9d1bd Compare June 1, 2023 04:41
-----------------------------------------
When executing a function on a separate thread that requires access to the Flask application context, the implementation was changed to use current_app instead of creating a new Flask app using create_app(). However, this change resulted in a RuntimeError with the message Working outside of application context.

This error is raised due to the use of current_app outside of a Flask application context. Flask's current_app is a proxy to the current active application instance, but it requires an active application context to function correctly.
While using current_app outside of an application context, Flask cannot determine the active application instance, leading to the error.
@sonarcloud
Copy link

sonarcloud bot commented Jun 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Aadesh-Baral Aadesh-Baral marked this pull request as ready for review June 1, 2023 06:02
@Aadesh-Baral Aadesh-Baral merged commit 097d56a into develop Jun 1, 2023
8 checks passed
@Aadesh-Baral Aadesh-Baral deleted the fix/5843-app-context branch June 1, 2023 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant