From 058086c9433b9691d9ccb2147231b63e16a7801c Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Mon, 16 Mar 2026 17:29:39 -0300 Subject: [PATCH] add support for displaying Django hostnames in application details --- app_gateway/views.py | 13 ++++++++++++- templates/app_gateway/application_details.html | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app_gateway/views.py b/app_gateway/views.py index 3d4d71d..94e7e26 100644 --- a/app_gateway/views.py +++ b/app_gateway/views.py @@ -1,3 +1,4 @@ +import ipaddress import os from django.conf import settings @@ -55,11 +56,21 @@ def view_application_details(request): hosts = application.hosts.all().order_by('hostname') routes = application.routes.all().order_by('order', 'path_prefix') + is_reserved = application.name == RESERVED_APP_NAME + django_hostnames = [] + if is_reserved: + for host in settings.ALLOWED_HOSTS: + try: + ipaddress.ip_address(host) + except ValueError: + django_hostnames.append(host) + context = { 'application': application, 'hosts': hosts, 'routes': routes, - 'is_reserved': application.name == RESERVED_APP_NAME, + 'is_reserved': is_reserved, + 'django_hostnames': django_hostnames, 'page_title': _('Application Details'), } return render(request, 'app_gateway/application_details.html', context) diff --git a/templates/app_gateway/application_details.html b/templates/app_gateway/application_details.html index 9a18789..6f8c44c 100644 --- a/templates/app_gateway/application_details.html +++ b/templates/app_gateway/application_details.html @@ -67,7 +67,7 @@ {% endif %} - {% if hosts %} + {% if hosts or django_hostnames %}
@@ -77,6 +77,12 @@ + {% for hostname in django_hostnames %} + + + + + {% endfor %} {% for host in hosts %}
{{ hostname }}
{{ host.hostname }}