<?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>Indirecthit &#187; StartupIndex</title>
	<atom:link href="http://www.indirecthit.com/category/startupindex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.indirecthit.com</link>
	<description>A Discussion on PHP, AJAX and Other Web Tools with a bit of startup talk</description>
	<lastBuildDate>Tue, 02 Mar 2010 15:34:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Django Caching Middleware &amp; Login Page</title>
		<link>http://www.indirecthit.com/2008/06/02/django-caching-middleware-login-page/</link>
		<comments>http://www.indirecthit.com/2008/06/02/django-caching-middleware-login-page/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 13:15:48 +0000</pubDate>
		<dc:creator>clong</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[StartupIndex]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[cache]]></category>

		<guid isPermaLink="false">http://www.indirecthit.com/?p=37</guid>
		<description><![CDATA[Recently on StartupIndex.ca, I&#8217;ve noticed a problem where the first time you login it fails, the second time it works. I sat down last night, and spent some time attempting to solve this problem. My search on the greater web didn&#8217;t end up with very many results, I did find one mailing list thread on [...]]]></description>
			<content:encoded><![CDATA[<p>Recently on StartupIndex.ca, I&#8217;ve noticed a problem where the first time you login it fails, the second time it works. I sat down last night, and spent some time attempting to solve this problem. My search on the greater web didn&#8217;t end up with very many results, I did find one mailing list thread on &#8220;<a href="http://groups.google.ca/group/django-users/browse_thread/thread/3d0694201341c205/abf83324933b243f?hl=en&amp;lnk=st&amp;q=django+login+auth+fails+multiple#abf83324933b243f">django.contrib.auth.views.login failing cookie test</a>&#8220;. This wasn&#8217;t exactly what I was looking for, but it set me down the right path.</p>
<p>Django comes with a <a href="http://www.djangoproject.com/documentation/cache/#the-per-site-cache">caching middleware</a> that caches any request made to the site that doesn&#8217;t have a POST or GET. You can set the cache to only cache pages for anonymous (using CACHE_MIDDLEWARE_ANONYMOUS_ONLY). The second piece of the puzzle is that the login view for Django sets a test cookie when a visitor first comes to the page, if this is not there, the login will fail.</p>
<p>What happens is:</p>
<ol>
<li>Make a request to the login page without any GET or POST parameters.</li>
<li>Web server returns the cached page. (Note: this doesn&#8217;t set the cookie because no Python code has been run, the page returned is static)</li>
<li>The user enters in the login information and submits the information. This is sent to the server as a POST.</li>
<li>The server, because of the POST, now runs the login view. This fails because there was no cookie previously set, but it does set the cookie that should have been previously set.</li>
<li>The error message shown to the user is as if it was a failed attempt. If the user reenters the information, the login will now work as the cookie is now set.</li>
</ol>
<p>Hopefully that makes some sense.</p>
<p>What is the solution? Unfortunately, the <a href="http://www.djangoproject.com/documentation/cache/#the-per-site-cache">caching middleware</a> doesn&#8217;t allow you to fine-grain what it caches, it&#8217;s an all or nothing. There are two solutions:</p>
<ol>
<li>Always pass a GET param to the login page. By passing a GET param, the <a href="http://www.djangoproject.com/documentation/cache/#the-per-site-cache">caching middleware</a> will not return the cached page.</li>
<li>Turn off the  <a href="http://www.djangoproject.com/documentation/cache/#the-per-site-cache">caching middleware</a> and instead use the more fine-grained <a href="http://www.djangoproject.com/documentation/cache/#the-per-view-cache">per-view cache</a>.</li>
</ol>
<p>I&#8217;m trying the GET parameter. We&#8217;ll see how it works.</p>]]></content:encoded>
			<wfw:commentRss>http://www.indirecthit.com/2008/06/02/django-caching-middleware-login-page/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>StartupIndex.ca Updated with Widgety Goodness</title>
		<link>http://www.indirecthit.com/2008/05/29/startupindexca-updated-with-widgety-goodness/</link>
		<comments>http://www.indirecthit.com/2008/05/29/startupindexca-updated-with-widgety-goodness/#comments</comments>
		<pubDate>Thu, 29 May 2008 16:26:27 +0000</pubDate>
		<dc:creator>clong</dc:creator>
				<category><![CDATA[StartupIndex]]></category>
		<category><![CDATA[startupindex.ca]]></category>

		<guid isPermaLink="false">http://www.indirecthit.com/?p=34</guid>
		<description><![CDATA[I updated StartupIndex.ca yesterday with some new features. Ali updated the map on the frontpage to be more intelligent and fixed some annoying problems with it. Now it looks better and responds better. We now have widgets! See below for an example widget, but this code can be placed into any webpage to give information [...]]]></description>
			<content:encoded><![CDATA[<p>I updated <a href="http://startupindex.ca">StartupIndex.ca</a> yesterday with some new features.</p>
<ul>
<li><a href="http://aliasaria.ca/blog/" class="ubernym uttJustLink" onmouseover="domTT_activate(this, event, 'content', 'The founder &amp; CEO of Well.ca','caption', 'Ali Asaria' );">Ali</a> updated the map on the frontpage to be more intelligent and fixed some annoying problems with it. Now it looks better and responds better.</li>
<li>We now have widgets! See below for an example widget, but this code can be placed into any webpage to give information on a startup or investor listed on <a href="http://startupindex.ca">StartupIndex.ca</a>. You can access the widget for any startup or investor by the &#8220;Embed Widget&#8221; option on the profile page.</li>
<li>A new addition that is not visible from the frontend is a new framework for moderation edits to StartupIndex. This will increase our turn around on approving changes. I&#8217;m planning on releasing the code for this as a separate Django application in the near future. More on that soon.</li>
</ul>
<div class="startupindex-info_widgetdetails"><script src="http://startupindex.ca/widgets/startup/akoha/" type="text/javascript"></script></p>
<div class="startupindex-footer"><a href="http://startupindex.ca/"><img style="border: none; padding: 0; margin: 0;" src="http://media.startupindex.ca/images/startupindexca_logo_tiny.png" alt="" align="absmiddle" /></a></div>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.indirecthit.com/2008/05/29/startupindexca-updated-with-widgety-goodness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StartupIndex: It&#8217;s ALIVE!</title>
		<link>http://www.indirecthit.com/2008/04/29/startupindex-its-alive/</link>
		<comments>http://www.indirecthit.com/2008/04/29/startupindex-its-alive/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 03:51:12 +0000</pubDate>
		<dc:creator>clong</dc:creator>
				<category><![CDATA[StartupIndex]]></category>

		<guid isPermaLink="false">http://www.indirecthit.com/?p=31</guid>
		<description><![CDATA[StartupIndex was launched tonight at StartupCampToronto. I&#8217;m really excited to see where this goes. We have lots of plans for the future, lots and lots of features and information. I&#8217;ll keep this blog updated when major updates are made. For now, check out StartupIndex and read Jevon&#8217;s post about StartupIndex on StartupNorth. Only a few [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://startupindex.ca">StartupIndex</a> was launched tonight at StartupCampToronto. I&#8217;m really excited to see where this goes. We have lots of plans for the future, lots and lots of features and information. I&#8217;ll keep this blog updated when major updates are made. For now, check out <a href="http://startupindex.ca">StartupIndex</a> and read <a href="http://www.startupnorth.ca/2008/04/29/startupindexca-free-our-data-free-the-community/">Jevon&#8217;s post</a> about <a href="http://startupindex.ca">StartupIndex</a> on <a href="http://www.startupnorth.ca">StartupNorth</a>. Only a few hours after the launch, and we&#8217;re already starting to see some input from the community!</p>
<p>Let us know if you see any problems, or have any brilliant ideas for where the site should go.</p>]]></content:encoded>
			<wfw:commentRss>http://www.indirecthit.com/2008/04/29/startupindex-its-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

