i'm trying read environment variables in django settings, have defined in /home/user/.bashrc (and latter in /etc/bash.bashrc ) , keyerror exception. know environment variables set, because can print them in terminal (echo $var_name). should trivial.
this code i'm using.
from django.core.exceptions import improperlyconfigured msg = "set %s environment variable" def get_env_variable(var_name): try: return os.environ[var_name] except keyerror: error_msg = msg % var_name raise improperlyconfigured(error_msg) os_db_user = get_env_variable('my_user') os_db_pass = get_env_variable('my_pass') os_db_db = get_env_variable('my_db') os_game_logs = get_env_variable('dir_logs') i can't find what's missing. suggestions out there?
thanks
edit: running on apache mod_wsgi.
i've manage solve problem using solution:
http://drumcoder.co.uk/blog/2010/nov/12/apache-environment-variables-and-mod_wsgi/
Comments
Post a Comment