<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Michael Jay Lissner</title><link href="https://michaeljaylissner.com/" rel="alternate"></link><link href="https://michaeljaylissner.com/feeds/tag/settingspy" rel="self"></link><id>https://michaeljaylissner.com/</id><updated>2010-02-24T17:15:54-08:00</updated><entry><title>Using Revision Control on a Django Project Without Revealing Your Passwords</title><link href="https://michaeljaylissner.com/posts/2010/02/24/using-revision-control-on-a-django-project-without-revealing-your-passwords/" rel="alternate"></link><updated>2010-02-24T17:15:54-08:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2010-02-24:posts/2010/02/24/using-revision-control-on-a-django-project-without-revealing-your-passwords/</id><summary type="html">&lt;p&gt;Just a quick post today, since this took me way too long to figure out. If you have a django project that you want to share without sharing the private bits of settings.py, there is an easy way to do&amp;nbsp;this. &lt;/p&gt;
&lt;p&gt;I tried for a while to to set up mercurial hooks that would strip out my passwords before each commit, and then place them back after each commit, thus avoiding uploading them publicly. This does not work however because all of the mercurial hooks happen after snapshots of the modified files have been made. So you can edit the files using a hook, but your edits will only go into effect upon the &lt;strong&gt;&lt;em&gt;next&lt;/em&gt;&lt;/strong&gt; check in. Clearly, this will not&amp;nbsp;do.&lt;/p&gt;
&lt;p&gt;Another solution that I tried was the mercurial &lt;a href="http://mercurial.selenic.com/wiki/KeywordExtension"&gt;keyword extension&lt;/a&gt;. This could work, but ultimately it does not because you have to remember to run it before and after each commit &amp;mdash; something I know I&amp;#8217;d forget sooner or&amp;nbsp;later.&lt;/p&gt;
&lt;p&gt;The solution that &lt;strong&gt;&lt;em&gt;does&lt;/em&gt;&lt;/strong&gt; work is to split up your settings.py file into 
multiple pieces such that there is a private file and a public file. I 
followed the instructions &lt;a href="http://code.djangoproject.com/wiki/SplitSettings#UsingalistofconffilesTransifex"&gt;here&lt;/a&gt;, with the resulting code looking being 
checked in &lt;a href="https://github.com/freelawproject/courtlistener/blob/master/alert/settings.py"&gt;here&lt;/a&gt; and &lt;a href="https://github.com/freelawproject/courtlistener/blob/master/alert/settings/10-public.py"&gt;here&lt;/a&gt;. There is also a file called 
&amp;#8220;20-private.py&amp;#8221; which is not uploaded publicly, and which contains all the 
private bits of code that would normally be found in settings.py. Thus, all of 
my settings can be found my django, but I do not have to share my private&amp;nbsp;ones.&lt;/p&gt;</summary><category term="settings.py"></category><category term="revision control"></category><category term="Python"></category><category term="mercurial"></category><category term="django"></category><category term="Final Project"></category></entry></feed>