Try catch at start

This commit is contained in:
CHIEFSOFT\ameye
2025-10-09 16:00:57 -04:00
parent 4c95112bde
commit 8c405c5d2e
+27 -23
View File
@@ -20,40 +20,44 @@ from flask_jwt_extended import (
def create_app():
"""Factory function to create a Flask app instance"""
# import oracledb
# oracledb.init_oracle_client(lib_dir=None)
app = Flask(__name__)
try:
# Load configuration
app.config.from_object(Config)
app = Flask(__name__)
CORS(app)
# Load configuration
app.config.from_object(Config)
JWTManager(app)
CORS(app, supports_credentials=True)
CORS(app)
# Swagger Doc
SWAGGER_URL = app.config.get("SWAGGER_URL")
API_URL = app.config.get("API_URL")
JWTManager(app)
CORS(app, supports_credentials=True)
# Register blueprints
app.register_blueprint(api)
# Swagger Doc
SWAGGER_URL = app.config.get("SWAGGER_URL")
API_URL = app.config.get("API_URL")
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
# Register blueprints
app.register_blueprint(api)
# Error Handlers
register_error_handlers(app)
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
from . import models
# Error Handlers
register_error_handlers(app)
# Initialize Flask-Mail
mail.init_app(app)
from . import models
# Database and Migrations
db.init_app(app)
# Initialize Flask-Mail
mail.init_app(app)
migrate.init_app(app, db)
# Database and Migrations
db.init_app(app)
return app
migrate.init_app(app, db)
return app
except Exception as e:
print(f"An unexpected error occurred: {e}")