How do I fix 'Popped wrong app context' in Flask with APScheduler Close 2 Posted by 2 years ago Archived The project was built with Flask, SqlAlchemy Postgres on the backend RQ for background tasks Jinja2 to generate html on par with htmx and alpinejs to add some reactivity It is open sourced, you can check out the code as well Data Models For this project, things are simple compared to most applications We only have a single table which is stored in the mystripeapp/modelspy file import sqlalchemy from flask import url_for from sqlalchemyextdeclarative import declared_attr from mystripeappbootstrap import app, db from flask_loginmixins import UserMixin from Your scheduler is probably using a single thread to run jobs, since they are so infrequent From Testquery it looks like you might be using FlaskSQLAlchemy, which defaults to using a scoped session, or in other words a threadlocal session Your job also does not end the transaction implicitly started by the query
Apscheduler Readthedocs Io