Relative Content

Tag Archive for pythonflaskcelerycelerybeat

How would you pass a Celery custom scheduler the current flask app context so you can perform database queries using SQLAlchemy?

I’ve decided to try to make a custom scheduler using Celery/Celery Beat to perform some simple queued tasks. This is my first time working with celery, so it’s possible part of my config could be wrong. But I think I simply need to somehow pass in my flask app to get past the error “RuntimeError: Working outside of application context.” that I get in my custom scheduler on start when it tries to perform a query with SQLAlchemy. I’m just having issues getting it to be used correctly in my scheduler so I can use ‘with app.app_context():’ while avoiding any circular dependencies. I’ve tried a few different approaches but I just cant seem to get it working appropir