Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

270
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!