- Fix upload folder path to be relative to Flask app static folder - Update app initialization to use proper static folder structure - Change default development port to 5001 to avoid AirPlay conflicts - Images now display correctly in both public and admin views The refactored app now properly serves uploaded images from the correct static file location. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
983 B
Python
40 lines
983 B
Python
"""
|
|
Configuration settings for the application
|
|
"""
|
|
|
|
import os
|
|
|
|
|
|
class Config:
|
|
"""Base configuration class"""
|
|
|
|
# Flask settings
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or os.urandom(24)
|
|
|
|
# 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'}
|
|
|
|
# Authentication settings
|
|
ADMIN_USERNAME = os.environ.get('ADMIN_USERNAME') or 'admin'
|
|
ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD') or 'password123'
|
|
|
|
# Database settings
|
|
DATABASE_PATH = os.environ.get('DATABASE_PATH') or 'pet_pictures.db'
|
|
|
|
|
|
class DevelopmentConfig(Config):
|
|
"""Development configuration"""
|
|
DEBUG = True
|
|
|
|
|
|
class ProductionConfig(Config):
|
|
"""Production configuration"""
|
|
DEBUG = False
|
|
|
|
|
|
class TestingConfig(Config):
|
|
"""Testing configuration"""
|
|
TESTING = True
|
|
DATABASE_PATH = ':memory:' |