diff --git a/app/__init__.py b/app/__init__.py index 27b2d75..b978d6c 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -15,7 +15,10 @@ def create_app(): app.config.from_object(Config) # Ensure upload directory exists - os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True) + upload_path = os.path.join(app.static_folder, 'uploads') + os.makedirs(upload_path, exist_ok=True) + # Update config to use absolute path for file operations + app.config['UPLOAD_FOLDER'] = upload_path # Setup logging from app.utils.logging_config import setup_logging diff --git a/app/config.py b/app/config.py index 28b860f..64c7bd8 100644 --- a/app/config.py +++ b/app/config.py @@ -11,8 +11,8 @@ class Config: # Flask settings SECRET_KEY = os.environ.get('SECRET_KEY') or os.urandom(24) - # Upload settings - UPLOAD_FOLDER = os.environ.get('UPLOAD_FOLDER') or 'app/static/uploads' + # Upload settings + UPLOAD_FOLDER = os.environ.get('UPLOAD_FOLDER') or 'static/uploads' MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'} diff --git a/main.py b/main.py index cb68abb..d038634 100644 --- a/main.py +++ b/main.py @@ -15,4 +15,5 @@ app = create_app() if __name__ == "__main__": # Development server configuration debug_mode = os.environ.get('FLASK_ENV') == 'development' - app.run(debug=debug_mode, host='0.0.0.0', port=5000) + port = int(os.environ.get('PORT', 5001)) # Use port 5001 to avoid AirPlay conflict + app.run(debug=debug_mode, host='0.0.0.0', port=port)