import os from flask import Flask from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() def create_app(): # Create the Flask app and set the template folder (located in app/templates) app = Flask(__name__, template_folder='templates') app.secret_key = 'your_super_secret_key_here' # Configure the SQLite database app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'domains.db') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # Initialize SQLAlchemy with the app db.init_app(app) with app.app_context(): # Import models so that they are registered with SQLAlchemy before creating tables from app import models db.create_all() # Register blueprints from app.routes.domain import domain_bp app.register_blueprint(domain_bp) from app.routes.ssl import ssl_bp app.register_blueprint(ssl_bp) from app.routes.tools import tools_bp app.register_blueprint(tools_bp) from app.routes.clients import clients_bp app.register_blueprint(clients_bp) return app