File size: 965 Bytes
6da9021 0d7ec51 6da9021 0d7ec51 6da9021 43f79f7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from celery import Celery
import redis
db = SQLAlchemy()
login = LoginManager()
celery = Celery(__name__)
cache = redis.Redis()
def create_app():
# Create the Flask app first
app = Flask(__name__)
# Load configuration
app.config.from_object('config.Config')
# Set the instance path after loading the config
app.instance_path = app.config['INSTANCE_PATH']
# Initialize extensions
db.init_app(app)
login.init_app(app)
celery.conf.update(app.config)
# Register Blueprints
from .routes.auth import auth_bp
from .routes.dashboard import dashboard_bp
from .routes.api import api_bp
from .routes.compliance import compliance_bp
app.register_blueprint(auth_bp)
app.register_blueprint(dashboard_bp)
app.register_blueprint(api_bp)
app.register_blueprint(compliance_bp)
return app |