Django apache environment variables

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?

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.

Back to Top