Features: 1) Add new DEBUG_DATABASE setting for database logging control; 2) Enable conditional logging based on DEBUG_DATABASE for django.db logger;

Fixes: 1) Correct type casting of `uuid` in payment transaction retrieval;

Extra: 1) Minor cleanup in logging configuration imports;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-11-12 22:05:15 +03:00
parent af49dacb09
commit f3a1bb7110
3 changed files with 8 additions and 2 deletions

View file

@ -72,7 +72,7 @@ class CallbackAPIView(APIView):
def post(self, request: Request, *args: list[Any], **kwargs: dict[Any, Any]) -> Response:
try:
transaction = Transaction.objects.get(uuid=kwargs.get("uuid", ""))
transaction = Transaction.objects.get(uuid=str(kwargs.get("uuid")))
if not transaction.gateway:
raise UnknownGatewayError()
gateway = transaction.gateway.get_integration_class_object()

View file

@ -14,6 +14,7 @@ INITIALIZED = (BASE_DIR / ".initialized").exists()
SECRET_KEY = getenv("SECRET_KEY", "SUPER_SECRET_KEY")
DEBUG = bool(int(getenv("DEBUG", "1")))
DEBUG_DATABASE = bool(int(getenv("DEBUG_DATABASE", "1")))
BASE_DOMAIN: str = getenv("EVIBES_BASE_DOMAIN", "localhost")
STOREFRONT_DOMAIN: str = getenv("EVIBES_STOREFRONT_DOMAIN", "localhost")

View file

@ -1,6 +1,6 @@
import logging
from evibes.settings.base import DEBUG
from evibes.settings.base import DEBUG, DEBUG_DATABASE
class SkipVariableDoesNotExistFilter(logging.Filter):
@ -63,6 +63,11 @@ LOGGING = {
"level": "DEBUG" if DEBUG else "INFO",
"propagate": True,
},
"django.db": {
"handlers": ["console"],
"level": "DEBUG" if DEBUG_DATABASE else "WARNING",
"propagate": True,
},
"django.template": {
"handlers": ["console"],
"level": "DEBUG" if DEBUG else "ERROR",