Files
erp-ai-latest/src/api/app.py
T
2024-09-11 14:46:03 +01:00

26 lines
851 B
Python

import os
from flask import Flask
from src.api.routes.sops import sops_bp
from src.api.routes.questions import qs_b
from src.api.routes.chatbot import bot
def create_app():
app = Flask(__name__)
# Register the blueprint with the desired prefix
app.register_blueprint(sops_bp, url_prefix='/api/v1/sop')
app.register_blueprint(qs_b,url_prefix='/api/v1/qs')
app.register_blueprint(bot,url_prefix='/api/v1/bot')
# 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