Django apache environment variables

21 Views Asked by At

I have a django project in which environment variables from a .env file work just fine in development mode, I can read them in my settings.py by using

SECRET_KEY = os.getenv('SECRET_KEY')

but when I confugure the project in the apache httpd.conf and access the django project, the error log complains about the missing values. How can I load those values to the apache server?

1

There are 1 best solutions below

0
user3347778 On BEST ANSWER

Well, the solution was to use this library: https://pypi.org/project/python-decouple/ I hope it could be useful for someone in the future.