You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

28 lines
937 B

from django.http import HttpResponse
import os
from django.conf import settings
def index(request):
return HttpResponse("¡Hola, mundo. Estamos en la vista index. Y he hecho un cambio. A ver si funciona")
def ver_variables_entorno(request):
# Variables a excluir por motivos de seguridad
variables_excluidas = {'SECRET_KEY', 'EMAIL_HOST_PASSWORD', 'API_KEY'}
# Obtiene todas las variables de entorno
entorno = {key: os.getenv(key) for key in os.environ.keys() if key not in variables_excluidas}
# Obtiene todas las variables de settings excluyendo las confidenciales
configuracion = {
key: getattr(settings, key) for key in dir(settings)
if key.isupper() and key not in variables_excluidas
}
# Combina ambas en un solo diccionario
contexto = {
'entorno': entorno,
'configuracion': configuracion
}
return render(request, 'ver_entorno.html', contexto)