Refactor URL handling to use BASE_URL across the application and add base_url context processor
All checks were successful
Deploy to Server / deploy (push) Successful in 22s
All checks were successful
Deploy to Server / deploy (push) Successful in 22s
This commit is contained in:
parent
999ab368e2
commit
d4fd35769d
11 changed files with 250 additions and 167 deletions
17
core/context_processors.py
Normal file
17
core/context_processors.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.http import HttpRequest
|
||||
|
||||
|
||||
def base_url(request: HttpRequest) -> dict[str, str]:
|
||||
"""Provide BASE_URL to templates for deterministic absolute URL creation.
|
||||
|
||||
Returns:
|
||||
dict[str, str]: A dictionary containing the BASE_URL.
|
||||
"""
|
||||
return {
|
||||
"BASE_URL": getattr(settings, "BASE_URL", ""),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue