Features: 1) Add fallback to environment variable for BASE_DOMAIN in middleware redirects; 2) Introduce new "Taskboard" link to Jazzmin settings;

Fixes: 1) Correct import of BASE_DOMAIN in DRF settings;

Extra: 1) Adjust "GraphQL Docs" and "REST Docs" labels to remove translation; 2) Reorganize Jazzmin settings links for consistency.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-11-11 17:27:26 +03:00
parent da2403c3c5
commit bf03534f1b
3 changed files with 6 additions and 7 deletions

View file

@ -1,7 +1,6 @@
import logging
from os import getenv
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import BadRequest, DisallowedHost, PermissionDenied, ValidationError
from django.http import HttpResponseForbidden
@ -21,7 +20,7 @@ class CustomCommonMiddleware(CommonMiddleware):
try:
return super().process_request(request)
except DisallowedHost:
return redirect(f"https://api.{settings.BASE_DOMAIN}")
return redirect(f"https://api.{getenv("EVIBES_BASE_DOMAIN", "localhost")}")
class CustomLocaleMiddleware(LocaleMiddleware):

View file

@ -3,8 +3,7 @@ from os import getenv
from django.utils.translation import gettext_lazy as _
from evibes.settings import BASE_DOMAIN
from evibes.settings.base import DEBUG, EVIBES_VERSION, SECRET_KEY
from evibes.settings.base import DEBUG, EVIBES_VERSION, SECRET_KEY, BASE_DOMAIN
from evibes.settings.constance import CONSTANCE_CONFIG
REST_FRAMEWORK: dict[str, str | int | list[str] | tuple[str, ...] | dict[str, bool]] = {

View file

@ -19,17 +19,18 @@ JAZZMIN_SETTINGS = {
"topmenu_links": [
{"name": _("Home"), "url": "admin:index"},
{"name": _("Storefront"), "url": f"https://{STOREFRONT_DOMAIN}", "new_window": True}, # type: ignore [index]
{"name": "GitLab", "url": "https://gitlab.com/wiseless/evibes", "new_window": True},
{
"name": _("GraphQL Docs"),
"name": "GraphQL Docs",
"url": f"https://api.{BASE_DOMAIN}/graphql", # type: ignore [index]
"new_window": True,
},
{
"name": _("REST Docs"),
"name": "REST Docs",
"url": f"https://api.{BASE_DOMAIN}/docs/swagger", # type: ignore [index]
"new_window": True,
},
{"name": _("Taskboard"), "url": "https://gitlab.com/wiseless/evibes", "new_window": True},
{"name": "GitLab", "url": "https://gitlab.com/wiseless/evibes", "new_window": True},
{"name": _("Support"), "url": "https://t.me/fureunoir", "new_window": True},
],
"usermenu_links": [],