- Added environment variable loading with python-dotenv - Fixed Docker session permissions by using /tmp directory - Updated .dockerignore to include .env file properly - Enhanced docker-compose.yml with env_file directive - Fixed Gunicorn configuration for Docker compatibility - Updated README.md with comprehensive deployment docs - Cleaned up debug logging from API routes - Added DOMAIN_SETUP.md for reverse proxy guidance - All production issues resolved and tested working - Application now accessible at qr.moto-adv.com
44 lines
1.2 KiB
Python
Executable File
44 lines
1.2 KiB
Python
Executable File
"""
|
|
QR Code Manager Flask Application
|
|
A modern Flask web application for generating and managing QR codes with authentication
|
|
"""
|
|
|
|
import os
|
|
from dotenv import load_dotenv
|
|
from flask import Flask
|
|
from flask_cors import CORS
|
|
from flask_session import Session
|
|
from app.utils.auth import init_admin
|
|
|
|
# Load environment variables
|
|
load_dotenv()
|
|
|
|
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
|
|
app.config['SESSION_FILE_DIR'] = '/tmp/flask_session' # Use /tmp for sessions
|
|
app.config['SESSION_FILE_THRESHOLD'] = 500
|
|
|
|
# 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
|