"""
Development settings for PX360 project.
"""
from .base import *  # noqa

DEBUG = True

ALLOWED_HOSTS = ['localhost', '127.0.0.1', '0.0.0.0']

# Database - Use PostgreSQL even in dev for consistency
# Override with SQLite if needed for quick local testing
# DATABASES = {
#     'default': env.db(
#         'DATABASE_URL',
#         default='postgresql://px360:px360@localhost:5432/px360'
#     )
# }

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}
# Email backend for development
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# Celery - Use eager mode for development (synchronous)
CELERY_TASK_ALWAYS_EAGER = env.bool('CELERY_TASK_ALWAYS_EAGER', default=False)
CELERY_TASK_EAGER_PROPAGATES = True

# CORS for development (if needed for frontend)
CORS_ALLOW_ALL_ORIGINS = True

# Django Debug Toolbar (optional)
if DEBUG:
    INSTALLED_APPS += ['django_extensions']  # noqa

# Logging - More verbose in development
LOGGING['loggers']['django']['level'] = 'DEBUG'  # noqa
LOGGING['loggers']['apps']['level'] = 'DEBUG'  # noqa

# Disable some security features for development
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False