[Fixed]-Cannot get environment variables in Django settings file

11👍

I’ve manage to solve my problem by using this solution:

http://drumcoder.co.uk/blog/2010/nov/12/apache-environment-variables-and-mod_wsgi/

👤luistm

1👍

I’ve just recently found the cause of this myself.

When running under apache/mod_wsgi, your application runs under a different user, so those environment variables are not set. Your options are:

  1. Use apache SetEnv directive in your virtualhost config,
  2. Set the environment variables for the user that apache runs your code as, or
  3. Tell apache to run the wsgidaemon process as your user.

Leave a comment