Fix: Resolve Django settings import error and fix quick login API endpoint
Settings Refactoring Fixes: - Add minimal LOGGING structure to base.py for multitenancy.py to extend - Restore LOGGING import in multitenancy.py - Add development LOGGING configuration to local.py - This allows multitenancy.py to extend LOGGING configuration properly Quick Login Fix: - Update frontend .env.development to use VITE_API_URL=http://localhost:8000 - Previous configuration tried to access api.lvh.me which failed due to django-tenants not recognizing that hostname - Using localhost:8000 directly bypasses subdomain routing and accesses the public schema where auth endpoints are available Both fixes restore full functionality: - Django now starts without import errors in local development - Quick login API calls now succeed and return authentication tokens - Frontend can authenticate users for development/testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
VITE_DEV_MODE=true
|
VITE_DEV_MODE=true
|
||||||
VITE_API_URL=http://lvh.me:8000
|
VITE_API_URL=http://localhost:8000
|
||||||
|
|||||||
@@ -224,6 +224,21 @@ MANAGERS = ADMINS
|
|||||||
# Force the `admin` sign in process to go through the `django-allauth` workflow
|
# Force the `admin` sign in process to go through the `django-allauth` workflow
|
||||||
DJANGO_ADMIN_FORCE_ALLAUTH = env.bool("DJANGO_ADMIN_FORCE_ALLAUTH", default=False)
|
DJANGO_ADMIN_FORCE_ALLAUTH = env.bool("DJANGO_ADMIN_FORCE_ALLAUTH", default=False)
|
||||||
|
|
||||||
|
# LOGGING - Base structure (extended by multitenancy.py, overridden by local.py/production.py)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Minimal structure here - actual handlers defined in environment-specific settings
|
||||||
|
LOGGING = {
|
||||||
|
"version": 1,
|
||||||
|
"disable_existing_loggers": False,
|
||||||
|
"formatters": {},
|
||||||
|
"handlers": {
|
||||||
|
"console": {
|
||||||
|
"level": "DEBUG",
|
||||||
|
"class": "logging.StreamHandler",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
REDIS_URL = env("REDIS_URL", default="redis://redis:6379/0")
|
REDIS_URL = env("REDIS_URL", default="redis://redis:6379/0")
|
||||||
REDIS_SSL = REDIS_URL.startswith("rediss://")
|
REDIS_SSL = REDIS_URL.startswith("rediss://")
|
||||||
|
|
||||||
|
|||||||
@@ -114,5 +114,16 @@ INSTALLED_APPS += ["django_extensions"]
|
|||||||
|
|
||||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-eager-propagates
|
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-eager-propagates
|
||||||
CELERY_TASK_EAGER_PROPAGATES = True
|
CELERY_TASK_EAGER_PROPAGATES = True
|
||||||
|
|
||||||
|
# LOGGING - Development
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Extend the base LOGGING configuration with development settings
|
||||||
|
LOGGING["disable_existing_loggers"] = False
|
||||||
|
LOGGING["formatters"]["verbose"] = {
|
||||||
|
"format": "%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s",
|
||||||
|
}
|
||||||
|
LOGGING["handlers"]["console"]["formatter"] = "verbose"
|
||||||
|
LOGGING["root"] = {"level": "DEBUG", "handlers": ["console"]}
|
||||||
|
|
||||||
# Your stuff...
|
# Your stuff...
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ This file extends base.py and adds django-tenants configuration
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from .base import * # noqa
|
from .base import * # noqa
|
||||||
from .base import INSTALLED_APPS, MIDDLEWARE, DATABASES, env
|
from .base import INSTALLED_APPS, MIDDLEWARE, DATABASES, LOGGING, env
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# MULTI-TENANCY CONFIGURATION (django-tenants)
|
# MULTI-TENANCY CONFIGURATION (django-tenants)
|
||||||
|
|||||||
Reference in New Issue
Block a user