22 lines
656 B
Python
22 lines
656 B
Python
|
|
import os
|
||
|
|
from flask import Flask
|
||
|
|
from src.api.routes.sops import sops_bp
|
||
|
|
|
||
|
|
def create_app():
|
||
|
|
app = Flask(__name__)
|
||
|
|
|
||
|
|
# Register the blueprint with the desired prefix
|
||
|
|
app.register_blueprint(sops_bp, url_prefix='/api/v1/sop')
|
||
|
|
|
||
|
|
# Set up the upload folder configuration inside the src directory
|
||
|
|
UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../uploads')
|
||
|
|
UPLOAD_FOLDER = os.path.abspath(UPLOAD_FOLDER)
|
||
|
|
|
||
|
|
# Make sure the upload folder exists
|
||
|
|
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
|
||
|
|
|
||
|
|
# Assign the upload folder path to Flask config
|
||
|
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||
|
|
|
||
|
|
return app
|