38 lines
980 B
Python
38 lines
980 B
Python
"""
|
|
QR Code Manager Flask Application
|
|
A modern Flask web application for generating and managing QR codes with authentication
|
|
"""
|
|
|
|
import os
|
|
from flask import Flask
|
|
from flask_cors import CORS
|
|
from flask_session import Session
|
|
from app.utils.auth import init_admin
|
|
|
|
def create_app():
|
|
"""Create and configure the Flask application"""
|
|
app = Flask(__name__)
|
|
|
|
# Configuration
|
|
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'your-secret-key-change-in-production')
|
|
app.config['SESSION_TYPE'] = 'filesystem'
|
|
app.config['SESSION_PERMANENT'] = False
|
|
app.config['SESSION_USE_SIGNER'] = True
|
|
|
|
# Initialize CORS
|
|
CORS(app)
|
|
|
|
# Initialize session
|
|
Session(app)
|
|
|
|
# Initialize admin user
|
|
init_admin()
|
|
|
|
# Register blueprints
|
|
from app.routes import main, api, auth
|
|
app.register_blueprint(main.bp)
|
|
app.register_blueprint(api.bp, url_prefix='/api')
|
|
app.register_blueprint(auth.bp)
|
|
|
|
return app
|