Try catch at start
This commit is contained in:
+27
-23
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user