Created
October 9, 2018 19:42
-
-
Save craigderington/93fdea42b44694691e252d0bfbc75e41 to your computer and use it in GitHub Desktop.
Dunder Init file for Celery project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from flask import Flask | |
| from flask_sqlalchemy import SQLAlchemy | |
| from celery import Celery | |
| from config import config | |
| celery = Celery() | |
| db = SQLAlchemy() | |
| def create_app(config_name=None): | |
| if config_name is None: | |
| config_name = os.environ.get('CONFIG', 'development') | |
| app = Flask(__name__) | |
| app.config.from_object(config[config_name]) | |
| celery.config_from_object(app.config) | |
| db.init_app(app) | |
| from app.views import home | |
| app.register_blueprint(home) | |
| return app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment