Spaces:
Sleeping
Sleeping
File size: 796 Bytes
623e0d6 e2c1f2e db7598d e2c1f2e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from flask import Flask
from app.routes import main_bp, api_bp
import os
def create_app():
app = Flask(__name__,
static_folder='static',
template_folder='templates')
# Load configuration
app.config.from_object('app.config')
# Ensure upload and encoded directories exist
upload_dir = os.getenv('UPLOAD_FOLDER', 'uploads')
encoded_dir = os.getenv('ENCODED_FOLDER', 'encoded')
os.makedirs(upload_dir, exist_ok=True)
os.makedirs(encoded_dir, exist_ok=True)
# Set upload folder in app config
app.config['UPLOAD_FOLDER'] = upload_dir
app.config['ENCODED_FOLDER'] = encoded_dir
# Register blueprints
app.register_blueprint(main_bp)
app.register_blueprint(api_bp, url_prefix='/api')
return app
|