title: My Django secret key is in an environment variable but I can't do syncdb
body: <p>I'm setting up a Django project with different files for local and production settings. I can confirm that my Django secret key is successfully in an environment variable in virtualenv and when I do runserver I get no error.  However when I try manage.py syncdb I get </p>
  
  <pre><code>django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
  </code></pre>
  
  <p>I don't understand why I can successfully browse to the site after runserver but I can't sync the database.  When I run env I can see that the secret key is there and in my base settings file (imported into local settings) I am doing this:</p>
  
  <pre><code>SECRET_KEY = os.environ.get('MY_SECRET_KEY')
  </code></pre>
  
  <p>Any help debugging this would be greatly appreciated.</p>
  
  <p>Euan</p>