Refactored to try to get celery into flask app context