Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
Environment variables works on Django's server but not on Apache server

When I use the environment variable in Django's server, it works.

SMTP_PASSWORD = os.environ["SMTP_PASSWORD"]

However, when I run the same code on Apache, it doesn't. The code os.environ["..."] just doesn't work.

I am using Windows 10, Python 3.9.5 and Django 3.2.4.

Any idea what is happening?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can put environment variables in the apache config.

<VirtualHost hostname:443>
   ...
   SetEnv SMTP_PASSWORD smtp_password
   ...
</VirtualHost>

If you don't want to put sensitive information in apache config you can still include your environment variable in your files, to read it when the server is starting or you can store those variables in your database.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda