I am new to web development so hopefully this is something ridiculously simple. I've been following the Django Girls Tutorial thus far. My goal is to hide the secret key. I tried several different approaches in hopes of getting this to work and have searched these forums with no luck. The only way I can seem to get it to work is by actually putting the hard code secret key in settings.py. I tried setting environment variables in bash shell. Setting the environment variables works when on development local server. I tried calling the env variable in settings.py by adding:
SECRET_KEY=os.environ.get('SECRET_KEY_MYSITE') *** I exported the key as "SECRET_KEY_MYSITE" *** Doing this only gave my the error: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
I also tried putting the key in wsgi.py by adding - os.environ["SECRET_KEY"] = "the secret key value". Then calling it in settings.py by - SECRET_KEY = os.getenv('SECRET_KEY'). Same error here: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.").
I'm sure I'm missing something rather obvious but can't seem to figure it out. In bash I am running environment with Python 3.4 and Django 1.8. I installed whitenoise as well. I've been reading all over the internet that the secret key needs to be hidden so I'm going the extra mile to make sure I get it done. Is hiding the secret key in settings.py here on PA necessary? As of right now I have the secret key in wsgi.py set to *** for security. I appreciate your help! Oh and you have permission to check out the error log.