Create the template for the Flask framework
This commit is contained in:
parent
db65646400
commit
c0f9876184
14 changed files with 266 additions and 0 deletions
35
app/__init__.py
Normal file
35
app/__init__.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_login import LoginManager
|
||||
from flask_migrate import Migrate
|
||||
from config import Config
|
||||
|
||||
db = SQLAlchemy()
|
||||
login_manager = LoginManager()
|
||||
migrate = Migrate()
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(Config)
|
||||
|
||||
db.init_app(app)
|
||||
login_manager.init_app(app)
|
||||
migrate.init_app(app, db)
|
||||
|
||||
# Register blueprints for modular routes
|
||||
from .routes.admin import admin_bp
|
||||
from .routes.auth import auth_bp
|
||||
from .routes.customer import customer_bp
|
||||
from .routes.repair import repair_bp
|
||||
from .routes.inventory import inventory_bp
|
||||
from .routes.technician import technician_bp
|
||||
from .routes.audit import audit_bp
|
||||
app.register_blueprint(admin_bp)
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(customer_bp)
|
||||
app.register_blueprint(repair_bp)
|
||||
app.register_blueprint(inventory_bp)
|
||||
app.register_blueprint(technician_bp)
|
||||
app.register_blueprint(audit_bp)
|
||||
|
||||
return app
|
||||
Loading…
Add table
Add a link
Reference in a new issue