|
|
|
@ -3,3 +3,24 @@ from django.http import HttpResponse |
|
|
|
|
|
|
|
def index(request): |
|
|
|
return HttpResponse("¡Hola, mundo. Estamos en la vista index. Y he hecho un cambio") |
|
|
|
|
|
|
|
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) |