Files
erp-ai-latest/src/api/app.py
T

26 lines
851 B
Python
Raw Normal View History

2024-08-31 01:29:39 +00:00
import os
from flask import Flask
from src.api.routes.sops import sops_bp
2024-09-10 02:51:31 +01:00
from src.api.routes.questions import qs_b
2024-09-11 14:46:03 +01:00
from src.api.routes.chatbot import bot
2024-08-31 01:29:39 +00:00
def create_app():
app = Flask(__name__)
# Register the blueprint with the desired prefix
app.register_blueprint(sops_bp, url_prefix='/api/v1/sop')
2024-09-10 02:51:31 +01:00
app.register_blueprint(qs_b,url_prefix='/api/v1/qs')
2024-09-11 14:46:03 +01:00
app.register_blueprint(bot,url_prefix='/api/v1/bot')
2024-08-31 01:29:39 +00:00
# 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