<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Seán Hayes &#187; django</title>
	<atom:link href="http://seanhayes.name/tag/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanhayes.name</link>
	<description>Web Developer in Rochester, NY (Django, JavaScript, LAMP)</description>
	<lastBuildDate>Fri, 06 Jan 2012 00:45:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cookies Not Saved In Internet Explorer for Facebook iframe Apps</title>
		<link>http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/</link>
		<comments>http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 01:02:16 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[p3p]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=238</guid>
		<description><![CDATA[I&#8217;m making a Facebook game using Django and was having a problem with Internet Explorer. The Problem: After login the page would render correctly as if the user was logged in, but when navigating to another page it was as &#8230; <a href="http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m making a Facebook game using Django and was having a problem with Internet Explorer.</p>
<p>The Problem: After login the page would render correctly as if the user was logged in, but when navigating to another page it was as if the user wasn&#8217;t logged in. Upon investigation I could see that the cookies weren&#8217;t being saved.</p>
<p>The Solution: A quick Gogole search brought me to this blog post: <a href="http://adamyoung.net/IE-Blocking-iFrame-Cookies">IE Blocking iFrame Cookies</a>. It&#8217;s an easy to fix P3P issue, and the author describes how to add the necessary header for various languages/frameworks.</p>
<p>Rather than add the header to each Django view or write custom Django middleware, I just added the header to my Apache configuration. The following goes in your VirtualHost Directive:</p>
<p>Header add P3P &#8216;CP=&#8221;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT&#8221;&#8216;</p>
<p>In order to work you have to enable mod_headers (run &#8220;sudo a2enmod headers&#8221;).</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/07/08/cookies-saved-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Test Database in Django</title>
		<link>http://seanhayes.name/2010/01/09/test-database-django/</link>
		<comments>http://seanhayes.name/2010/01/09/test-database-django/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 14:27:07 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[test database]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=132</guid>
		<description><![CDATA[At Govnex we&#8217;re using MySQL on our development machines. It has several advantages, but one of the drawbacks is unittests run slower when not using Sqlite (big ups to MockSoul for posting his benchmarks). The reason for this is when &#8230; <a href="http://seanhayes.name/2010/01/09/test-database-django/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At Govnex we&#8217;re using MySQL on our development machines. It has several advantages, but one of the drawbacks is <a title="#8138 (Switch django tests to use transactions)" href="http://code.djangoproject.com/ticket/8138#comment:34">unittests run slower when not using Sqlite</a> (big ups to MockSoul for posting his benchmarks). The reason for this is when running unittests in Django with a Sqlite database, the database is run in memory (RAM) instead of being written to the disk.</p>
<p>Django only allows you to specify one database, and although a new database is created for unittests, <a href="http://docs.djangoproject.com/en/dev/topics/testing/#the-test-database">it still uses most of the same settings</a> (auto prepending &#8220;test_&#8221; to the database name), which means a Django install using MySQL also uses MySQL for unittests.</p>
<p>To get around this problem, I created a file in my project root called test_settings.py containing the following lines:<br />
<script type="text/javascript" src="http://gist.github.com/269919.js?file=test_settings.py"></script></p>
<p>I then opened my settings.py, imported sys, and inserted the following lines at the end of the file:<br />
<script type="text/javascript" src="http://gist.github.com/269919.js?file=settings.py"></script></p>
<p>If one of the command line arguments is &#8220;test&#8221;, that means a unittest is being run, in which case Django will attempt to import test_settings.py, which will override the database settings and use Sqlite instead. <a title="Cross Database Incompatibility Using Django South" href="http://seanhayes.name/2010/01/09/cross-database-incompatibility/">Migrations won&#8217;t be an issue</a>, since Django South uses the old syncdb command for generating databases for unittests.</p>
<p>Hope this helps you save some time testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/01/09/test-database-django/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

