22 lines
642 B
Python
22 lines
642 B
Python
from flask import Flask
|
|
import os
|
|
from app.config import Config
|
|
|
|
def create_app(config_class=Config):
|
|
app = Flask(__name__)
|
|
app.config.from_object(config_class)
|
|
|
|
# Ensure upload directory exists
|
|
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
|
|
|
|
# Create empty URI map file if it doesn't exist
|
|
uri_map_path = os.path.join(app.config['UPLOAD_FOLDER'], 'uri_map.json')
|
|
if not os.path.exists(uri_map_path):
|
|
with open(uri_map_path, 'w') as f:
|
|
f.write('{}')
|
|
|
|
# Register blueprints
|
|
from app.routes.main import main_bp
|
|
app.register_blueprint(main_bp)
|
|
|
|
return app
|