Browse Source

Actualizar 'polls/views.py'

main
creylopez 11 months ago
parent
commit
ab73cc0af7
1 changed files with 21 additions and 0 deletions
  1. +21
    -0
      polls/views.py

+ 21
- 0
polls/views.py View File

@ -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)

Loading…
Cancel
Save