ogn-python/app/__init__.py

39 wiersze
928 B
Python
Czysty Zwykły widok Historia

2019-02-10 12:10:19 +00:00
from flask import Flask
2019-02-10 13:00:35 +00:00
from flask_bootstrap import Bootstrap
2019-02-10 12:10:19 +00:00
from flask_sqlalchemy import SQLAlchemy
2019-04-27 11:33:36 +00:00
from flask_migrate import Migrate
2019-04-02 21:48:24 +00:00
from flask_caching import Cache
2019-03-10 14:58:10 +00:00
from celery import Celery
2019-02-25 19:00:51 +00:00
2019-08-31 08:14:41 +00:00
from app.flask_celery import make_celery
2019-02-10 12:10:19 +00:00
2019-09-12 20:53:42 +00:00
bootstrap = Bootstrap()
db = SQLAlchemy()
cache = Cache()
2019-09-12 20:53:42 +00:00
def create_app(config_name='development'):
# Initialize Flask
app = Flask(__name__)
2019-02-10 12:10:19 +00:00
2019-09-12 20:53:42 +00:00
# Load the configuration
if config_name == 'testing':
app.config.from_object('app.config.test')
else:
app.config.from_object('app.config.default')
app.config.from_envvar("OGN_CONFIG_MODULE", silent=True)
2019-08-31 08:14:41 +00:00
2019-09-12 20:53:42 +00:00
# Initialize other things
bootstrap.init_app(app)
db.init_app(app)
cache.init_app(app)
#migrate = Migrate(app, db)
#celery = make_celery(app)
from app.main import bp as bp_main
app.register_blueprint(bp_main)
2019-09-12 19:29:29 +00:00
2019-09-12 20:53:42 +00:00
#from app import commands
return app