The 'app' is created in views.py. The folder structure is:
~/tasks/
/tasks
/__init__.py
/cron1.py
/views.py # app object is created here
There are some functions that I wish to import in the standalone cron1.py which I wish to run as cron job. The cron function call I make as follows:
if __name__ == '__main__':
try:
with app.app_context():
# with current_app.test_request_context():
get_recurring_tasklist()
except Exception, e:
print e
On execution from root folder with command $ PYTHONPATH=. python tasks/create_recurring_tasks.py
Error I get is: working outside of request context
I am using a method call from views which uses request object. How to go about?