Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions gettingstarted/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,42 @@
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

# Customise the default logging config, since by default full Django logs are only emitted when
# `DEBUG=True` (which otherwise makes diagnosing errors much harder in production):
# https://docs.djangoproject.com/en/5.1/ref/logging/#default-logging-configuration
# For more advanced logging you may want to try: https://django-structlog.readthedocs.io
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "[{levelname}] {message}",
"style": "{",
},
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "simple",
},
},
# Fallback for anything not configured via `loggers`.
"root": {
"handlers": ["console"],
"level": "INFO",
},
"loggers": {
"django": {
"handlers": ["console"],
"level": "INFO",
# Prevent double logging due to the root logger.
"propagate": False,
},
"django.request": {
# Suppress the WARNINGS from any HTTP 4xx responses (in particular for 404s caused by
# web crawlers), but still show any ERRORs from HTTP 5xx responses/exceptions.
"level": "ERROR",
},
},
}