<div class="gmail_quote">On Sat, Jun 23, 2012 at 8:47 AM, Adam &quot;Cezar&quot; Jenkins <span dir="ltr">&lt;<a href="mailto:emperorcezar@gmail.com" target="_blank">emperorcezar@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
At work I&#39;m working on a new infrastructure. For various reasons, I really like how Heroku does app local settings, but can&#39;t use Heroku. They are set in the environment variables. For instance, I would use the Heroku command like so <div>

<br></div><div>heroku config:add aws_key=1234567890</div><div><br></div><div>and I could pull that in side my Django settings file with env[&#39;aws_key&#39;]</div><div><br></div><div>So I&#39;ve been wondering what the best way is to set environment variables on a per virtualenv case? So far I&#39;ve only come up with a custom activate script, or code in my Django app that updates the env dictionary using a .cfg or .yml file found in the virtualenv. I&#39;m sure there&#39;s some python or bash magic that would make it easier?</div>

<br></blockquote><div>I use YamJam, a yaml config file setup.  I work in a corp environment, so lots of my settings are the same for different projects, i.e. where is the accounting data, where are pdfs stored, etc.   So I end up with a system that uses config settings at a user level and then project specific, or overrides at the project level (machine or debug/production specific).   ~/.yamjam/config.yaml + project/config.yaml</div>
<div><br></div><div>I like YamJam because it&#39;s just a light layer over pyyaml that handles config setting merging intelligently. </div><div><a href="http://code.google.com/p/yamjam/">http://code.google.com/p/yamjam/</a></div>
<div><br></div><div>May not be what you are looking for, but it would save you from re-inventing your .cfg/.yml code to update settings.py.</div><div><br></div><div>Django needs some work there, storing db credentials and SECRET_KEY in a piece of code that needs to be in a repository is troublesome. </div>
</div><br clear="all"><div><br></div>-- <br>Best,<div><br></div><div>Jeff Hinrichs<br>402.218.1473<br><br></div><br>