<?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>Mellow Morning</title>
	<atom:link href="http://www.mellowmorning.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mellowmorning.com</link>
	<description>Blogging the world of IT and Business</description>
	<lastBuildDate>Sat, 11 May 2013 12:14:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Django Facebook &#8211; 1.5 and custom user model support</title>
		<link>http://www.mellowmorning.com/2013/05/11/django-facebook-1-5-and-custom-user-model-support/</link>
		<comments>http://www.mellowmorning.com/2013/05/11/django-facebook-1-5-and-custom-user-model-support/#comments</comments>
		<pubDate>Sat, 11 May 2013 12:14:48 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=762</guid>
		<description><![CDATA[Django Facebook now officially supports Django 1.5 and custom user models! Go try it out and upgrade to pip version 5.1.1. It&#8217;s backwards compatible and you can choose if you want to keep on using profiles, or migrate to the new custom user model. Installation instructions can be found on github.

Contributing
Thanks for all the contributions! [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a> now officially supports Django 1.5 and <a href="https://docs.djangoproject.com/en/dev/topics/auth/customizing/#auth-custom-user">custom user models</a>! Go try it out and upgrade to pip version 5.1.1. It&#8217;s backwards compatible and you can choose if you want to keep on using profiles, or migrate to the new custom user model. Installation instructions can be found on <a href="https://github.com/tschellenbach/Django-facebook">github</a>.</p>
<p><a href="http://www.mellowmorning.com/wp-content/uploads/2013/05/passing.png"><img src="http://www.mellowmorning.com/wp-content/uploads/2013/05/passing.png" alt="" title="passing" width="610" height="307" class="aligncenter size-full wp-image-766" /></a></p>
<h3>Contributing</h3>
<p>Thanks for all the contributions! My startup (<a href="http://www.fashiolista.com">Fashiolista</a>) depends on a reliable Facebook integration and maintaining it would not be possible without all the pull requests from the community. Contributions are strongly appreciated. Seriously, give Github a try, fork and get started :)</p>
<h3>About Django Facebook</h3>
<p>Django Facebook enables your users to easily register using the Facebook API. It converts the Facebook user data and creates regular User and Profile objects. This makes it easy to integrate with your existing Django application.</p>
<p>I&#8217;ve built it for my startup <a href="http://www.fashiolista.com">Fashiolista.com</a> and it&#8217;s currently used in production with thousands of signups per day. For a demo of the signup flow have a look at Fashiolista&#8217;s landing page (<a href="http://www.fashiolista.com/intro_wide_minimal/">fashiolista.com</a>)</p>
<p>After registration Django Facebook gives you access to user&#8217;s graph. Allowing for applications such as:</p>
<ul>
<li>Open graph/ Timeline functionality</li>
<li>Seamless personalization</li>
<li>Inviting friends</li>
<li>Finding friends</li>
<li>Posting to a users profile</li>
</ul>
<p>Django Facebook helps you quickly develop Facebook applications using Django.<br />
Let me know what features or issues you are encountering!</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F11%2Fdjango-facebook-1-5-and-custom-user-model-support%2F&amp;title=Django%20Facebook%20-%201.5%20and%20custom%20user%20model%20support" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F11%2Fdjango-facebook-1-5-and-custom-user-model-support%2F&amp;title=Django%20Facebook%20-%201.5%20and%20custom%20user%20model%20support" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F11%2Fdjango-facebook-1-5-and-custom-user-model-support%2F&amp;title=Django%20Facebook%20-%201.5%20and%20custom%20user%20model%20support" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F11%2Fdjango-facebook-1-5-and-custom-user-model-support%2F&amp;t=Django%20Facebook%20-%201.5%20and%20custom%20user%20model%20support" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F11%2Fdjango-facebook-1-5-and-custom-user-model-support%2F&amp;title=Django%20Facebook%20-%201.5%20and%20custom%20user%20model%20support" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F11%2Fdjango-facebook-1-5-and-custom-user-model-support%2F&amp;title=Django%20Facebook%20-%201.5%20and%20custom%20user%20model%20support" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2013/05/11/django-facebook-1-5-and-custom-user-model-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Facebook hotfix, update to 5.0.13</title>
		<link>http://www.mellowmorning.com/2013/05/01/django-facebook-hotfix-update-to-5-0-13/</link>
		<comments>http://www.mellowmorning.com/2013/05/01/django-facebook-hotfix-update-to-5-0-13/#comments</comments>
		<pubDate>Wed, 01 May 2013 10:35:31 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[api]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=746</guid>
		<description><![CDATA[Last night Facebook changed the format they use for codes. (codes are an intermediate step in the process of requesting access tokens.)
This change broke the caching for the convert code step for Django Facebook, breaking login, connect and registration functionality. Fortunately this was quickly reported by developers in a country where there was no Queensday [...]]]></description>
			<content:encoded><![CDATA[<p>Last night Facebook changed the format they use for codes. (codes are an intermediate step in the process of requesting access tokens.)</p>
<p>This change broke the caching for the convert code step for Django Facebook, breaking login, connect and registration functionality. Fortunately this was quickly <a href="https://github.com/tschellenbach/Django-facebook/issues/304">reported</a> by developers in a country where there was no Queensday yesterday.</p>
<p>I encourage everybody to update to 5.0.13 to make sure your Facebook integration keeps on working.</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F01%2Fdjango-facebook-hotfix-update-to-5-0-13%2F&amp;title=Django%20Facebook%20hotfix%2C%20update%20to%205.0.13" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F01%2Fdjango-facebook-hotfix-update-to-5-0-13%2F&amp;title=Django%20Facebook%20hotfix%2C%20update%20to%205.0.13" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F01%2Fdjango-facebook-hotfix-update-to-5-0-13%2F&amp;title=Django%20Facebook%20hotfix%2C%20update%20to%205.0.13" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F01%2Fdjango-facebook-hotfix-update-to-5-0-13%2F&amp;t=Django%20Facebook%20hotfix%2C%20update%20to%205.0.13" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F01%2Fdjango-facebook-hotfix-update-to-5-0-13%2F&amp;title=Django%20Facebook%20hotfix%2C%20update%20to%205.0.13" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2013%2F05%2F01%2Fdjango-facebook-hotfix-update-to-5-0-13%2F&amp;title=Django%20Facebook%20hotfix%2C%20update%20to%205.0.13" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2013/05/01/django-facebook-hotfix-update-to-5-0-13/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open graph and timeline sharing using Django Facebook</title>
		<link>http://www.mellowmorning.com/2012/10/03/open-graph-and-timeline-sharing-using-django-facebook/</link>
		<comments>http://www.mellowmorning.com/2012/10/03/open-graph-and-timeline-sharing-using-django-facebook/#comments</comments>
		<pubDate>Wed, 03 Oct 2012 11:04:38 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[django facebook]]></category>
		<category><![CDATA[open graph]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=713</guid>
		<description><![CDATA[As many apps will find out today, Facebook is removing it&#8217;s offline_access permission on October 3rd. For most apps this will mean that many of your open graph shares start failing. 
Fashiolista has built up quite some experience with tweaking this and today we&#8217;ll be sharing some tips. The actual code we&#8217;re using has been [...]]]></description>
			<content:encoded><![CDATA[<p>As many apps will find out today, Facebook is removing it&#8217;s <a href="https://developers.facebook.com/roadmap/offline-access-removal/">offline_access permission</a> on October 3rd. For most apps this will mean that many of your open graph shares start failing. </p>
<p><a href="http://www.fashiolista.com/">Fashiolista</a> has built up quite some experience with tweaking this and today we&#8217;ll be sharing some tips. The actual code we&#8217;re using has been included in the latest version of <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a>. </p>
<h3>1.) Store and retry your shares</h3>
<p>There are several advantages of storing your open graph shares in the database. You get:</p>
<ul>
<li>Stats</li>
<li>Error tracking</li>
<li>Ability to retry individual shares</li>
<li>Ability to retry a user&#8217;s shares if you get an updated token</li>
<li>Ability to delete shares (since you store the Facebook object id)</li>
</ul>
<p>Especially the ability to retry shares was important to us. <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a> provides a convenient OpenGraphShare model to store all your shares in. Have a look at the example below:</p>
<pre class="python" name="code">
class DjangoModel:
    def share_to_facebook(self, graph=None):
        from django_facebook.models import OpenGraphShare
        #this is where the magic happens
        share = OpenGraphShare.objects.create(
            user_id=self.user_id,
            action_domain='fashiolista:love',
            content_type=content_type,
            object_id=self.id,
        )
        share.set_share_dict(kwargs)
        share.save()
        result = share.send()
</pre>
<p>Note that we store all info required for sharing to Facebook in the OpenGraphShare model. The actual Facebook API request is sent when you call share.send().</p>
<p>Using this flow has the benefit that Django Facebook will retry your open graph shares if a user&#8217;s token updates. By doing this more of your open graph shares will actually reach Facebook.</p>
<h3>2.) Extend your tokens</h3>
<p>Facebook&#8217;s has deprecated offline access. By default you will now get a short lived access token (usually 1-2 hours). Often you will want longer lived tokens though. For example when your app keeps a user logged in for 30 days, storing a token once with a duration of 2 hours doesn&#8217;t get you very far. If you need longer lived tokens, you can now extend your token via a Facebook API call. These long lived tokens will keep working for 60 days.</p>
<p>The high level API for extending tokens is located in:</p>
<pre class="python" name="code">user.get_profile().extend_access_token()</pre>
<p>In the new version of Django Facebook your token will be automatically extended upon connecting with Facebook. There is however a performance overhead to this extra API call. That&#8217;s where the following point comes in:</p>
<h3>3.) Use Celery</h3>
<p>Calling the Facebook API is something which takes quite a bit of time. If you&#8217;re unlucky a single API call can easily take up to 2000 ms. Celery is a tool which allows you to easily run tasks in the background, ensuring your pages stay fast for the users. At <a href="http://www.fashiolista.com/">Fashiolista</a> we use tasks for checking comment spam, adding loves, clearing cache, posting to Facebook and extending your Facebook access tokens. You can learn more about Celery in <a href="http://docs.celeryproject.org/en/master/getting-started/index.html">this guide</a>.</p>
<p>Setting up Django Facebook to use Celery is trivial. Simply set the following settings to True.</p>
<pre class="python" name="code">
#Use celery for storing friends or likes
FACEBOOK_CELERY_STORE = True
#Use celery for extending access tokens in the background
FACEBOOK_CELERY_TOKEN_EXTEND = True
</pre>
<p>Using Celery speeds things up enormously for the end user, so I recommend using it.</p>
<h3>Concluding</h3>
<p>Upgrading to the latest version of <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a> and implementing these tips will get you a very solid open graph implementation. Let me know in the comments what steps you&#8217;ve taken to get these numbers up.</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F10%2F03%2Fopen-graph-and-timeline-sharing-using-django-facebook%2F&amp;title=Open%20graph%20and%20timeline%20sharing%20using%20Django%20Facebook" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F10%2F03%2Fopen-graph-and-timeline-sharing-using-django-facebook%2F&amp;title=Open%20graph%20and%20timeline%20sharing%20using%20Django%20Facebook" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F10%2F03%2Fopen-graph-and-timeline-sharing-using-django-facebook%2F&amp;title=Open%20graph%20and%20timeline%20sharing%20using%20Django%20Facebook" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F10%2F03%2Fopen-graph-and-timeline-sharing-using-django-facebook%2F&amp;t=Open%20graph%20and%20timeline%20sharing%20using%20Django%20Facebook" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F10%2F03%2Fopen-graph-and-timeline-sharing-using-django-facebook%2F&amp;title=Open%20graph%20and%20timeline%20sharing%20using%20Django%20Facebook" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F10%2F03%2Fopen-graph-and-timeline-sharing-using-django-facebook%2F&amp;title=Open%20graph%20and%20timeline%20sharing%20using%20Django%20Facebook" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2012/10/03/open-graph-and-timeline-sharing-using-django-facebook/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Performance metrics for a social network</title>
		<link>http://www.mellowmorning.com/2012/08/22/performance-metrics-for-a-social-network/</link>
		<comments>http://www.mellowmorning.com/2012/08/22/performance-metrics-for-a-social-network/#comments</comments>
		<pubDate>Wed, 22 Aug 2012 14:30:38 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Scaling]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[andreessen horowitz]]></category>
		<category><![CDATA[graphite]]></category>
		<category><![CDATA[newrelic]]></category>
		<category><![CDATA[pgfouine]]></category>
		<category><![CDATA[postgress]]></category>
		<category><![CDATA[software eating the world]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=694</guid>
		<description><![CDATA[This is a talk I gave at the Amsterdam Performance Meetup.
The presentation starts by introducing Fashiolista.
It still amazes me and 3 other guys started Fashiolista and grew it to the 2nd largest online Fashion community.
I guess Marc Andreesen had a point in his &#8220;Why Software Is Eating The World&#8221; article.
The talk focuses on how we [...]]]></description>
			<content:encoded><![CDATA[<p>This is a talk I gave at the <a href="http://www.meetup.com/Dutch-Web-Operations-Meetup/events/74967432/">Amsterdam Performance Meetup</a>.</p>
<p>The presentation starts by introducing Fashiolista.<br />
It still amazes me and 3 other guys started Fashiolista and grew it to the 2nd largest online Fashion community.<br />
I guess Marc Andreesen had a point in his <a href="http://online.wsj.com/article/SB10001424053111903480904576512250915629460.html">&#8220;Why Software Is Eating The World&#8221;</a> article.</p>
<p>The talk focuses on how we use metrics to drive optimization at Fashiolista.<br />
And narrows down on tools like:</p>
<ul>
<li><a href="http://newrelic.com/">NewRelic</a></li>
<li><a href="http://graphite.goteam.be/">Graphite</a></li>
<li><a href="http://pgfouine.projects.postgresql.org/">PgFouine</a></li>
</ul>
<p>If you&#8217;re looking up the links from the presentation, these are the most notable ones:</p>
<ul>
<li><a href="http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/">Etsy on Statsd</a></li>
<li><a href="https://gist.github.com/2307647">Instagram on PgFouine</a></li>
<li><a href="http://www.fashiolista.com/jobs/">Fashiolista Jobs</a></li>
<li><a href="http://www.github.com/tschellenbach">My Github</a></li>
<li><a href="http://www.github.com/tschellenbach/Django-Facebook">Django Facebook</a></li>
</ul>
<h3>The Presentation</h3>
<p><iframe src="http://www.slideshare.net/slideshow/embed_code/14029465?rel=0" width="597" height="486" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen> </iframe>
<div style="margin-bottom:5px"> <strong> <a href="http://www.slideshare.net/thierryschellenbach/performance-metrics-for-a-social-network-v4" title="Performance metrics for a social network" target="_blank">Performance metrics for a social network</a> </strong> from <strong><a href="http://www.slideshare.net/thierryschellenbach" target="_blank">Thierry Schellenbach</a></strong> </div>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F08%2F22%2Fperformance-metrics-for-a-social-network%2F&amp;title=Performance%20metrics%20for%20a%20social%20network" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F08%2F22%2Fperformance-metrics-for-a-social-network%2F&amp;title=Performance%20metrics%20for%20a%20social%20network" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F08%2F22%2Fperformance-metrics-for-a-social-network%2F&amp;title=Performance%20metrics%20for%20a%20social%20network" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F08%2F22%2Fperformance-metrics-for-a-social-network%2F&amp;t=Performance%20metrics%20for%20a%20social%20network" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F08%2F22%2Fperformance-metrics-for-a-social-network%2F&amp;title=Performance%20metrics%20for%20a%20social%20network" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F08%2F22%2Fperformance-metrics-for-a-social-network%2F&amp;title=Performance%20metrics%20for%20a%20social%20network" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2012/08/22/performance-metrics-for-a-social-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fashiolista in NY</title>
		<link>http://www.mellowmorning.com/2012/02/11/fashiolista-in-ny/</link>
		<comments>http://www.mellowmorning.com/2012/02/11/fashiolista-in-ny/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 18:16:16 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=678</guid>
		<description><![CDATA[The Fashiolista team is in New York for the fashion week. I&#8217;m looking forward to meet some local tech startups. Drop me a mail or leave a comment if you want to grab a coffee.
Cheers,
Thierry Schellenbach
CTO/ Founder
Fashiolista



Share and Enjoy:


	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>The Fashiolista team is in New York for the fashion week. I&#8217;m looking forward to meet some local tech startups. Drop me a mail or leave a comment if you want to grab a coffee.</p>
<p>Cheers,<br />
Thierry Schellenbach<br />
CTO/ Founder<br />
Fashiolista</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F11%2Ffashiolista-in-ny%2F&amp;title=Fashiolista%20in%20NY" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F11%2Ffashiolista-in-ny%2F&amp;title=Fashiolista%20in%20NY" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F11%2Ffashiolista-in-ny%2F&amp;title=Fashiolista%20in%20NY" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F11%2Ffashiolista-in-ny%2F&amp;t=Fashiolista%20in%20NY" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F11%2Ffashiolista-in-ny%2F&amp;title=Fashiolista%20in%20NY" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F11%2Ffashiolista-in-ny%2F&amp;title=Fashiolista%20in%20NY" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2012/02/11/fashiolista-in-ny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook open graph publishing simplified</title>
		<link>http://www.mellowmorning.com/2012/02/01/facebook-open-graph/</link>
		<comments>http://www.mellowmorning.com/2012/02/01/facebook-open-graph/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 19:00:15 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[f8]]></category>
		<category><![CDATA[open graph]]></category>
		<category><![CDATA[open graph beta]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=583</guid>
		<description><![CDATA[Facebook has just enabled the open graph for 60 lucky apps. The new open graph beta allows you to post a user&#8217;s actions to their timeline. This activity is shown to the user&#8217;s friends in Facebook&#8217;s newsfeed and ticker. Furthermore your data is nicely aggregated on a user&#8217;s Facebook profile. Fashiolista&#8217;s aggregation for instance looks [...]]]></description>
			<content:encoded><![CDATA[<p>Facebook has just enabled the open graph for <a href="http://mashable.com/2012/01/18/facebook-60-apps-timeline/" target="_blank">60 lucky apps</a>. The new open graph beta allows you to post a user&#8217;s actions to their timeline. This activity is shown to the user&#8217;s friends in Facebook&#8217;s newsfeed and ticker. Furthermore your data is nicely aggregated on a user&#8217;s Facebook profile. Fashiolista&#8217;s aggregation for instance looks like this:</p>
<p><a href="http://www.mellowmorning.com/wp-content/uploads/2012/01/aggregation.png"><img src="http://www.mellowmorning.com/wp-content/uploads/2012/01/aggregation.png" alt="" title="aggregation" width="417" height="196" class="aligncenter size-full wp-image-638" style="margin-left:70px;" /></a></p>
<p>Posting these actions on Facebook can greatly enhance the viral growth of your company. Spotify, one of the launch partners, has grown by more than <a href="http://techcrunch.com/2011/11/08/music-app-stats/" target="_blank"></a>4mil active users. This blogpost explains how to use <a href="https://github.com/tschellenbach/Django-facebook" target="_blank">Django Facebook</a> to integrate your Django based site with Facebook.</p>
<h3>How open graph works</h3>
<p>Before going into the code though we need to understand the basic concepts of the open graph: <b>actions</b> and <b>objects</b>. Facebook&#8217;s getting started interface explains it best:</p>
<p><a href="http://www.mellowmorning.com/wp-content/uploads/2011/12/Open-Graph-Getting-Started.png"><img class="aligncenter size-full wp-image-608" title="Open Graph Getting Started" src="http://www.mellowmorning.com/wp-content/uploads/2011/12/Open-Graph-Getting-Started.png" alt="" width="533" height="87" style="margin-left:40px;" /></a></p>
<p>Actions are the verb, objects are what the action is applied to. You submit the data for these actions and objects to Facebook. An example would be watching (action) the movie Pan&#8217;s Labyrinth (object). Every object should be represented by a dedicated URL. For instance if you look at <a href="http://www.fashiolista.com/style/chiaraferragni/" target="_blank">Chiara&#8217;s profile (object)</a> on Fashiolista you will see the following open graph data:</p>
<pre class="python" name="code">&lt;meta property="og:title" content="ChiaraFerragni" /&gt;
&lt;meta property="og:image" content="http://bit.ly/rso3ig" /&gt;
&lt;meta property="og:type" content="fashiolista:fashiolista" /&gt;
&lt;meta property="og:site_name" content="Fashiolista" /&gt;</pre>
<p>To post to the open graph you specify an action and the url for the object. You can read more about it in <a href="https://developers.facebook.com/docs/opengraph/" target="_blank" />Facebook&#8217;s open graph docs</a>.</p>
<h3>Getting permission</h3>
<p>Users only need to give you permission to the open graph once. You specifically need the <b>publish_actions</b> permission. When asking for this permission a pretty permission interface as shown below will appear:</p>
<p><a href="http://www.mellowmorning.com/wp-content/uploads/2012/01/authentication.png"><img src="http://www.mellowmorning.com/wp-content/uploads/2012/01/authentication.png" alt="" title="authentication" width="639" height="335" class="aligncenter size-full wp-image-633" /></a></p>
<p>Notice the tiny add to timeline box displayed at the bottom right corner of the interface.</p>
<h3>Posting to the graph</h3>
<p>The code below will show you how to post to the open graph. There are however a few requirements which you&#8217;ll need to go through.</p>
<ol>
<li><a href="https://developers.facebook.com/apps" target="_blank">Register your own Facebook app and define actions and items</a></li>
<li><a href="https://github.com/tschellenbach/Django-facebook" target="_blank">Have Django Facebook installed</a></li>
</ol>
<h4>Simple posting to the graph</h4>
<p>After receiving this permission we can post to the user&#8217;s timeline. Below is the most basic example:</p>
<pre class="python" name="code">@facebook_required(scope='publish_actions')
def open_graph_beta(request):
    '''
    Simple example view on how to do open graph postings
    '''
    fb = get_persistent_graph(request)
    entity_url = 'http://www.fashiolista.com/item/2081202/'
    result = fb.set('me/fashiolista:love', item=entity_url)
    messages.info(request, 'The item has been shared to fashiolista:love')
</pre>
<p>This posts the action <b>love</b> to the users timeline with the object data found at the url http://www.fashiolista.com/item/2081202/.<br />
The syntax me/fashiolista:love translates to post to <b>me</b> in the namespace <b>fashiolista</b> with the action <b>love</b>.</p>
<h4>Asynchronous posting to the graph</h4>
<p>While the above example works, you often won&#8217;t want to keep your users waiting for the Facebook API request. Especially since they are quite sluggish at the moment.<br />
Below there&#8217;s a version of the code using <a href="http://celeryproject.org/" target="_blank">celery</a>. Celery is a task queuing system which enables you to run tasks asynchronously.</p>
<pre class="python" name="code">@task.task(ignore_result=True)
def open_graph_beta(user):
    '''
    Example posting to open graph using a celery task
    '''
    profile = user.get_profile()
    fb = profile.get_offline_graph()
    entity_url = 'http://www.fashiolista.com/item/2081202/'
    result = fb.set('me/fashiolista:love', item=entity_url)</pre>
<h3>Concluding</h3>
<p>Integrating with open graph is easy. Head over to the <a href="https://github.com/tschellenbach/Django-facebook" target="_blank">github page of Django Facebook</a> to get started. Contributions are more than welcome.</p>
<h3>Fashiolista Jobs</h3>
<p>Do you also see the beauty in clean code? Are you experienced with high scalability web apps? Currently we&#8217;re looking for additional talent over at our Amsterdam office. Feel free to drop me a line at my personal email for more information: thierryschellenbach[át]gmail.com</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F01%2Ffacebook-open-graph%2F&amp;title=Facebook%20open%20graph%20publishing%20simplified" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F01%2Ffacebook-open-graph%2F&amp;title=Facebook%20open%20graph%20publishing%20simplified" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F01%2Ffacebook-open-graph%2F&amp;title=Facebook%20open%20graph%20publishing%20simplified" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F01%2Ffacebook-open-graph%2F&amp;t=Facebook%20open%20graph%20publishing%20simplified" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F01%2Ffacebook-open-graph%2F&amp;title=Facebook%20open%20graph%20publishing%20simplified" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2012%2F02%2F01%2Ffacebook-open-graph%2F&amp;title=Facebook%20open%20graph%20publishing%20simplified" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2012/02/01/facebook-open-graph/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django Facebook 3.2 &#8211; Simple image upload and wall posts</title>
		<link>http://www.mellowmorning.com/2011/10/23/django-facebook-3-2-simple-image-upload-and-wall-posts/</link>
		<comments>http://www.mellowmorning.com/2011/10/23/django-facebook-3-2-simple-image-upload-and-wall-posts/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 22:21:27 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[decorator]]></category>
		<category><![CDATA[facebook_required]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=568</guid>
		<description><![CDATA[Most of the Facebook examples are written in PHP and unfortunately for us they always seem so damn simple. I think the Python libraries should allow you to write more elegant code and the new version of Django Facebook let&#8217;s you do just that.
Much of the new found simplicity comes from the facebook_required decorator. This [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the <a href="http://developers.facebook.com/blog/post/498">Facebook examples </a>are written in PHP and unfortunately for us they always seem so damn simple. I think the Python libraries should allow you to write more elegant code and the new version of <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a> let&#8217;s you do just that.</p>
<p>Much of the new found simplicity comes from the facebook_required decorator. This decorator is similar to login_required, but instead checks the Facebook permissions given to you. Writing the input of a form to someone&#8217;s wall is now as simple as this:</p>
<pre class="python" name="code">
@facebook_required(scope='publish_stream')
def wall_post(request):
    fb = get_persistent_graph(request)

    message = request.POST.get('message')
    fb.set('me/feed', message=message)

    messages.info(request, 'Posted the message to your wall')

    return next_redirect(request)
</pre>
<p>Another example would be uploading some photos to a user&#8217;s timeline:</p>
<pre class="python" name="code">
@facebook_required(scope='publish_stream,user_photos')
def image_upload(request):
    fb = get_persistent_graph(request)
    pictures = request.POST.getlist('pictures')

    for picture in pictures:
        fb.set('me/photos', url=picture, message='the writing is one The '
            'wall image %s' % picture)

    messages.info(request, 'The images have been added to your profile!')

    return next_redirect(request)
</pre>
<p>As you can see the syntax is very straightforward. You no longer have any technical excuse against integrating Facebook.<br />
More examples and installation instructions can be found on <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook&#8217;s github</a>.</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F10%2F23%2Fdjango-facebook-3-2-simple-image-upload-and-wall-posts%2F&amp;title=Django%20Facebook%203.2%20-%20Simple%20image%20upload%20and%20wall%20posts" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F10%2F23%2Fdjango-facebook-3-2-simple-image-upload-and-wall-posts%2F&amp;title=Django%20Facebook%203.2%20-%20Simple%20image%20upload%20and%20wall%20posts" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F10%2F23%2Fdjango-facebook-3-2-simple-image-upload-and-wall-posts%2F&amp;title=Django%20Facebook%203.2%20-%20Simple%20image%20upload%20and%20wall%20posts" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F10%2F23%2Fdjango-facebook-3-2-simple-image-upload-and-wall-posts%2F&amp;t=Django%20Facebook%203.2%20-%20Simple%20image%20upload%20and%20wall%20posts" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F10%2F23%2Fdjango-facebook-3-2-simple-image-upload-and-wall-posts%2F&amp;title=Django%20Facebook%203.2%20-%20Simple%20image%20upload%20and%20wall%20posts" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F10%2F23%2Fdjango-facebook-3-2-simple-image-upload-and-wall-posts%2F&amp;title=Django%20Facebook%203.2%20-%20Simple%20image%20upload%20and%20wall%20posts" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/10/23/django-facebook-3-2-simple-image-upload-and-wall-posts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>5 ways in which Facebook redefines online marketing</title>
		<link>http://www.mellowmorning.com/2011/09/21/5-ways-in-which-facebook-redefines-online-marketing/</link>
		<comments>http://www.mellowmorning.com/2011/09/21/5-ways-in-which-facebook-redefines-online-marketing/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 22:00:48 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[django facebook]]></category>
		<category><![CDATA[f8]]></category>
		<category><![CDATA[invite flow]]></category>
		<category><![CDATA[open graph]]></category>
		<category><![CDATA[social media]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=498</guid>
		<description><![CDATA[
img.aligncenter {
border: 1px solid gray;
padding: 2px;
margin: 5px 5px 5px 50px;
}

In the last few years the landscape for online marketing has shifted towards Facebook. The most obvious point is Facebook&#8217;s own ad platform, which currently exceeds 2 billion dollar in revenue. However the more fundamental changes are caused by Facebook&#8217;s social platform. This article outlines the [...]]]></description>
			<content:encoded><![CDATA[<style>
img.aligncenter {
border: 1px solid gray;
padding: 2px;
margin: 5px 5px 5px 50px;
}
</style>
<p>In the last few years the landscape for online marketing has shifted towards Facebook. The most obvious point is Facebook&#8217;s own ad platform, which currently exceeds <a href="http://www.huffingtonpost.com/2011/06/20/facebook-ad-revenue_n_880755.html">2 billion dollar in revenue</a>. However the more fundamental changes are caused by Facebook&#8217;s social platform. This article outlines the 5 ways in which Facebook is redefining online marketing.</p>
<p><i>About Thierry Schellenbach: Co-Founder of <a href="http://www.fashiolista.com/">Fashiolista.com</a>, author of <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a>. Follow me on <a href="http://twitter.com/#!/tschellenbach">Twitter</a> or <a href="http://www.facebook.com/tschellenbach">Facebook</a></i></p>
<h3>1. Interest based marketing</h3>
<p>Firstly Facebook allows you to target your advertising to specific interest groups. Especially for community driven sites it&#8217;s now possible to reach your target audience with almost scary precision. A marketeer can target all single girls living in Amsterdam, which like snowboarding and work at Google. This improved targeting enables you to attract visitors which are more likely to use your product.</p>
<p><a href="http://www.facebook.com/business/dashboard/">Try out Facebook advertising</a></p>
<h3>2. Zero friction authentication</h3>
<p>The Facebook effect continues when users reach your landing page. Instead of filling out a form with annoying questions, users just need to find the big blue button on your site and they are good to go.<br />
Having a Facebook login flow on your site drastically increases your conversion to members. Also the Facepile social plugin shows you which of your friends are using the site you&#8217;re visiting. This creates another incentive for users to join your site.</p>
<p><a href="http://www.fashiolista.com/intro_wide/"><img src="http://www.mellowmorning.com/wp-content/uploads/2011/09/FashiolistaIntroWide.png" alt="" title="FashiolistaIntroWide" width="519" height="298" class="aligncenter size-full wp-image-516 center" /></a><br />
A good example of a zero friction signup flow is the <a href="http://www.fashiolista.com/intro_wide/?utm_content=flow2">Fashiolista landing page</a> as shown above.</p>
<h3>3. Instant personalization and Friends</h3>
<p>The first two points allow you to acquire more users at a substantially lower member acquisition cost than previously possible. In addition the user accounts created by the Facebook connect flow immediately contain very rich information. You know their birthday, their age, their email, their gender and more importantly their real name. Using real names on online platforms substantially reduces spam and trolling. Furthermore since you know the user&#8217;s Facebook id you can connect them to their friends.</p>
<p><a href="http://pinterest.com/"><img src="http://www.mellowmorning.com/wp-content/uploads/2011/09/PinterestFriends.png" alt="" title="PinterestFriends" width="519" height="298" class="aligncenter size-full wp-image-527" /><br />
</a><br />
<a href="http://pinterest.com/">Pinterest</a> for instance makes it extremely easy to follow your Facebook friends on Pinterest.</p>
<h3>4. Like based personalization</h3>
<p>Facebook started focusing on likes about a year and a half ago when they released the open graph protocol and like buttons. Currently many users have indicated which sports, movies and brands they like. You can utilize this data to immediately connect the users to topics they care about.</p>
<p><a href="http://www.quora.com/"><img src="http://www.mellowmorning.com/wp-content/uploads/2011/09/Quora.png" alt="" title="Quora" width="519" height="201" class="aligncenter size-full wp-image-526" /></a><br />
<a href="http://www.quora.com/">Quora </a>is the leading example on how to personalize your content to new users. When you join Quora topics will be suggested to you based on your interests. So someone interested in Entrepreneurship will see entirely different content than someone interested in gardening.</p>
<h3>5. Social sharing &#8211; Evangelists</h3>
<p>Some of these users you just acquired will absolutely love your product. (Stop marketing and improve your product if they don&#8217;t). Previously these users would maybe email a friend or two and if you&#8217;re lucky tell their colleagues about it. Facebook however empowers them to easily share your product to all of their friends. Evangelists which would maybe recruit two new members are enabled by Facebook to recruit dozens. It is very common for user&#8217;s of Fashiolista to invite more than 30 of their friends, many of which become members.</p>
<p><a href="http://www.fashiolista.com/my_style/facebook_friends/"><img src="http://www.mellowmorning.com/wp-content/uploads/2011/09/FriendInvite.png" alt="" title="FriendInvite" width="519" height="274" class="aligncenter size-full wp-image-524" /></a><br />
The <a href="http://www.fashiolista.com/my_style/facebook_friends/">invite flow on Fashiolista</a> smartly shows your female friends, which are not yet on Fashiolista and enables you to quickly send an invite message to their wall.<br />
Similar, albeit less pretty invite flows are a strong component of games like CityVille and Farmville.</p>
<h3>Conclusion and on to F8</h3>
<p>Facebook has so far reduced the cost of getting visitors to your site. In addition it has become easier for these visitors to become members and receive a personalized experience.<br />
Finally Facebook empowers your evangelists to reach more of their friends than was previously possible. Throughout these steps the cost and friction involved with recruiting new members have been substantially reduced.</p>
<p>On September 22nd Facebook will make several announcements at their <a href="http://f8.facebook.com/">F8 conference</a>.<br />
Have a look at the <a href="http://f8.facebook.com/">livestream</a> to find on how they will change online marketing again.</p>
<p><i>About Thierry Schellenbach: Co-Founder of <a href="http://www.fashiolista.com/">Fashiolista.com</a>, author of <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a>. Follow me on <a href="http://twitter.com/#!/tschellenbach">Twitter</a> or <a href="http://www.facebook.com/tschellenbach">Facebook</a></i></p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F09%2F21%2F5-ways-in-which-facebook-redefines-online-marketing%2F&amp;title=5%20ways%20in%20which%20Facebook%20redefines%20online%20marketing" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F09%2F21%2F5-ways-in-which-facebook-redefines-online-marketing%2F&amp;title=5%20ways%20in%20which%20Facebook%20redefines%20online%20marketing" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F09%2F21%2F5-ways-in-which-facebook-redefines-online-marketing%2F&amp;title=5%20ways%20in%20which%20Facebook%20redefines%20online%20marketing" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F09%2F21%2F5-ways-in-which-facebook-redefines-online-marketing%2F&amp;t=5%20ways%20in%20which%20Facebook%20redefines%20online%20marketing" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F09%2F21%2F5-ways-in-which-facebook-redefines-online-marketing%2F&amp;title=5%20ways%20in%20which%20Facebook%20redefines%20online%20marketing" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F09%2F21%2F5-ways-in-which-facebook-redefines-online-marketing%2F&amp;title=5%20ways%20in%20which%20Facebook%20redefines%20online%20marketing" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/09/21/5-ways-in-which-facebook-redefines-online-marketing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amsterdam based, VC funded startup, Fashiolista looking for new team members</title>
		<link>http://www.mellowmorning.com/2011/08/15/amsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members/</link>
		<comments>http://www.mellowmorning.com/2011/08/15/amsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 08:44:32 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=424</guid>
		<description><![CDATA[Over the past months Fashiolista has grown to be one of the largest fashion communities worldwide. Dividing attention between scaling the site and creating new features has been quite a challenge. We are looking for a very experienced django developer to join our team.
About Fashiolista
Fashiolista is best described as &#8220;twitter for fashion&#8221;. Girls follow each [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mellowmorning.com/wp-content/uploads/2011/08/logo_fashiolista_700x350_new1.png"><img class="alignleft" title="logo_fashiolista_700x350_new[1]" src="http://www.mellowmorning.com/wp-content/uploads/2011/08/logo_fashiolista_700x350_new1-e1313257985852.png" alt="" width="200" height="100" /></a>Over the past months Fashiolista has grown to be one of the largest fashion communities worldwide. Dividing attention between scaling the site and creating new features has been quite a challenge. We are looking for a very experienced django developer to join our team.</p>
<h3>About Fashiolista</h3>
<p>Fashiolista is best described as &#8220;twitter for fashion&#8221;. Girls follow each other&#8217;s fashion finds and indicate which items they love. We are funded by Atomico ventures and several high profile angel investors.</p>
<h3>Why you will love working at Fashiolista</h3>
<p>- Young team, startup culture<br />
- Developers in the founding team<br />
- The team has been working with Django for more than 4 years<br />
- Modern stack (Django 1.3, postgres, redis, memcached, jquery, celery, solr, GIT)<br />
- Learning culture</p>
<p>Did I mention we are located in the centre of Amsterdam?</p>
<h3>Who we are looking for</h3>
<p>We are looking for a talented Django developer with experience in building highly scalable applications. Since our team is small, strong experience with Linux or Freebsd system administration would be a big plus.</p>
<ul>
<li>Experienced with Django and Python (&gt; 3 years preferably)</li>
<li>Knowledge of SQL and query optimization</li>
<li>Javascript experience</li>
<li>Test driven development</li>
<li>Memcached and other caching techniques</li>
<li>GIT</li>
</ul>
<p><strong>Bonus points for</strong>:</p>
<ul>
<li>Knowledge of FreeBSD or Linux system administration</li>
<li>Redis/ NoSql experience</li>
<li>SOLR experience</li>
<li>Postgres Trigger experience</li>
<li>Celery experience</li>
<li>CS degree</li>
</ul>
<p>For this position you need to be willing to work in The Netherlands/ Amsterdam. Furthermore the position is full time.</p>
<h3>To conclude</h3>
<p>We are looking for someone with an excellent work attitude and considerable experience. It doesn’t matter if you are a student, cum laude graduate, or drop out, as long as you&#8217;re extremely passionate about what you do. You will be working in a startup and we expect your input on a wide range of challenges.</p>
<p>If you recognize yourself in the above description or would like more information please contact me at:<br />
thierry&#8230;fashiolista.com</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F15%2Famsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members%2F&amp;title=Amsterdam%20based%2C%20VC%20funded%20startup%2C%20Fashiolista%20looking%20for%20new%20team%20members" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F15%2Famsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members%2F&amp;title=Amsterdam%20based%2C%20VC%20funded%20startup%2C%20Fashiolista%20looking%20for%20new%20team%20members" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F15%2Famsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members%2F&amp;title=Amsterdam%20based%2C%20VC%20funded%20startup%2C%20Fashiolista%20looking%20for%20new%20team%20members" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F15%2Famsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members%2F&amp;t=Amsterdam%20based%2C%20VC%20funded%20startup%2C%20Fashiolista%20looking%20for%20new%20team%20members" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F15%2Famsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members%2F&amp;title=Amsterdam%20based%2C%20VC%20funded%20startup%2C%20Fashiolista%20looking%20for%20new%20team%20members" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F15%2Famsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members%2F&amp;title=Amsterdam%20based%2C%20VC%20funded%20startup%2C%20Fashiolista%20looking%20for%20new%20team%20members" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/08/15/amsterdam-based-vc-funded-startup-fashiolista-looking-for-new-team-members/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Facebook 3.0 &#8211; OAuth migration &#8211; Time to upgrade!</title>
		<link>http://www.mellowmorning.com/2011/08/13/django-facebook-3-0-oauth-migration-time-to-upgrade/</link>
		<comments>http://www.mellowmorning.com/2011/08/13/django-facebook-3-0-oauth-migration-time-to-upgrade/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 14:40:16 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[django facebook]]></category>
		<category><![CDATA[open graph]]></category>
		<category><![CDATA[open graph api]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=434</guid>
		<description><![CDATA[Facebook is migrating to HTTPS and OAuth to increase the safety of their users. Unfortunately these changes aren&#8217;t backwards compatible and will require some effort to follow. To support the new Facebook system you need to upgrade to Django Facebook 3.0 before October 1st.
In addition to the required migrations, this version also includes several new [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Facebook is migrating to HTTPS and OAuth to increase the safety of their users. Unfortunately these changes aren&#8217;t backwards compatible and will require some effort to follow. To support the new Facebook system you need to upgrade to <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook 3.0</a> before October 1st.</strong></p>
<p>In addition to the required migrations, this version also includes several new features. The largest change is the underlying Facebook API client. You can read about the improvements here or skip down to the upgrade instructions.</p>
<h3>Open Facebook &#8211; New Python Facebook client</h3>
<p>Open Facebook is a python client to the Facebook graph API. Currently it&#8217;s included in Django Facebook, but in time it will be spun of as a separate project. The client is supported, tested and up to date with the current version of Facebook&#8217;s graph API.<br />
It handles connection issues cleanly and raises separate error classes for various Facebook error scenarios.<br />
The syntax is very straightforward to use:</p>
<pre class="python" name="code">
open_facebook = OpenFacebook(token)
#info about me
open_facebook.me()

#retrieving a page
open_facebook.get('fashiolista')

#retrieving your albums
open_facebook.get('me/albums')

#posting a message on your wall
open_facebook.set('me/feed', message='Check out Fashiolista', picture=image_url)

#setting a like
open_facebook.set('fashiolista/likes')

#fql example
result = open_facebook.fql('SELECT name FROM user WHERE uid = me()')

#authorization is handled separately from the API class
token = FacebookAuthorization.get_app_access_token()
test_user = FacebookAuthorization.create_test_user(token)
</pre>
<h4>Album upload Example</h4>
<p>Uploading pictures to Facebook is as simple as this:</p>
<pre class="python" name="code">
open_facebook = get_facebook_graph(request)
photo_urls = [
    'http://d.fashiocdn.com/images/entities/0/6/t/p/d/0.365x365.jpg',
    'http://e.fashiocdn.com/images/entities/0/5/E/b/Q/0.365x365.jpg',
]
for photo in photo_urls:
    uploaded = open_facebook.set('me/photos', url=photo,
        message='Fashiolista is awesome', name='FashiolistaTest'
    )
</pre>
<p>So there are good reasons to upgrade even if Facebook didn&#8217;t force us to :)</p>
<h3>How to upgrade to 3.0</h3>
<p><b>First Step &#8211; Install Django Facebook 3.0</b><br />
Follow the <a href="https://github.com/tschellenbach/Django-facebook/">installation instructions.</a></p>
<p><b>Javascript changes</b><br />
In your Facebook initialization code enable OAuth. </p>
<pre class="javascript" name="code">
FB.init({appId: facebookAppId, status: false, cookie: true, xfbml: true, oauth: true});
</pre>
<p>Perms has been renamed to scope.</p>
<pre class="javascript" name="code">
FB.login(function() {}, {'scope' : 'offline_access'});
</pre>
<p><b>Django Facebook changes</b><br />
The get_facebook_graph function is no longer persistent by default, if you want the old behavior use get_persistent_graph.<br />
Furthermore the FacebookUserConverter class and the core Facebook API client are now separated. get_facebook_graph returns the core facebook API client. To go from the API class to the user converter class use something like</p>
<pre class="python" name="code">
graph = get_facebook_graph(request)
facebook = FacebookUserConverter(graph)
</pre>
<p>That should be all.<br />
If you are encountering problems feel free to let me know in the comments.</p>
<p><b>Last Step &#8211; Enable the new Facebook Migrations</b><br />
Go to the <a href="https://developers.facebook.com/apps">Facebook Apps page</a> and enable the OAuth migration.<br />
Select your app -> About -> Advanced -> Migrations<br />
Enable Force OAuth<br />
Enable OAuth Migration</p>
<h3>Background reading</h3>
<p><a href="http://developers.facebook.com/blog/post/497/">Moving to OAuth 2.0 + HTTPS</a><br />
<a href="http://developers.facebook.com/blog/post/525/">Updated JavaScript SDK and OAuth 2.0 Roadmap</a><br />
<a href="http://developers.facebook.com/docs/authentication/">New Facebook Authentication Docs</a><br />
<a href="http://developers.facebook.com/blog/post/534/">PHP SDK v.3.1.1</a><br />
<a href="http://developers.facebook.com/blog/post/503/">PHP SDK v3.0.0</a></p>
<h3>We&#8217;re hiring!</h3>
<p>Do you also see the beauty in clean code? Are you experienced with high scalability web apps? Currently we&#8217;re looking for additional talent over at our Amsterdam office. Feel free to drop me a line at my personal email for more information: thierryschellenbach[at]gmail.com</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F13%2Fdjango-facebook-3-0-oauth-migration-time-to-upgrade%2F&amp;title=Django%20Facebook%203.0%20-%20OAuth%20migration%20-%20Time%20to%20upgrade%21" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F13%2Fdjango-facebook-3-0-oauth-migration-time-to-upgrade%2F&amp;title=Django%20Facebook%203.0%20-%20OAuth%20migration%20-%20Time%20to%20upgrade%21" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F13%2Fdjango-facebook-3-0-oauth-migration-time-to-upgrade%2F&amp;title=Django%20Facebook%203.0%20-%20OAuth%20migration%20-%20Time%20to%20upgrade%21" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F13%2Fdjango-facebook-3-0-oauth-migration-time-to-upgrade%2F&amp;t=Django%20Facebook%203.0%20-%20OAuth%20migration%20-%20Time%20to%20upgrade%21" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F13%2Fdjango-facebook-3-0-oauth-migration-time-to-upgrade%2F&amp;title=Django%20Facebook%203.0%20-%20OAuth%20migration%20-%20Time%20to%20upgrade%21" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F08%2F13%2Fdjango-facebook-3-0-oauth-migration-time-to-upgrade%2F&amp;title=Django%20Facebook%203.0%20-%20OAuth%20migration%20-%20Time%20to%20upgrade%21" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/08/13/django-facebook-3-0-oauth-migration-time-to-upgrade/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Django Facebook 2.0 &#8211; Integrating Facebook</title>
		<link>http://www.mellowmorning.com/2011/06/23/django-facebook-2-0-integrating-facebook/</link>
		<comments>http://www.mellowmorning.com/2011/06/23/django-facebook-2-0-integrating-facebook/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 15:18:40 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[django facebook]]></category>
		<category><![CDATA[Facebook connect]]></category>
		<category><![CDATA[Facebook login]]></category>
		<category><![CDATA[Facebook registration]]></category>
		<category><![CDATA[facebook sdk]]></category>
		<category><![CDATA[open graph]]></category>
		<category><![CDATA[Social authentication]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=350</guid>
		<description><![CDATA[It&#8217;s been a year since Facebook changed the web with the open graph API and their like button. Unfortunately Facebook didn&#8217;t have much developer love for the python/django platform. Django Facebook aims to make it easy to build facebook apps and integrate facebook with your website.
Key functionality
One of the strong points of Django Facebook is [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a year since Facebook changed the web with the open graph API and their like button. Unfortunately Facebook didn&#8217;t have much <a href="http://developers.facebook.com/blog/post/417/">developer love</a> for the python/django platform. <a href="https://github.com/tschellenbach/Django-facebook">Django Facebook</a> aims to make it easy to build facebook apps and integrate facebook with your website.</p>
<h3>Key functionality</h3>
<p>One of the strong points of Django Facebook is the ability to register users using Facebook. It ports all of Facebook&#8217;s user data to the Django user and profile models. This allows you to have a secure register/connect/login flow using Facebook, greatly reducing the barriers to start using your application. Below an example of me registering for Fashiolista using the <a href="http://www.fashiolista.com/intro_wide/">Facebook register flow</a>. </p>
<p style="text-align: center;"><b>Me on Facebook</b><br /><img class="size-full wp-image-366 aligncenter" title="thierry_facebook" src="http://www.mellowmorning.com/wp-content/uploads/2011/05/thierry_facebook.png" alt="" width="569" height="196" /></p>
<p style="text-align: center;"><b>Me on Fashiolista</b><br /><img class="size-full wp-image-367 aligncenter" title="thierry_fashiolista" src="http://www.mellowmorning.com/wp-content/uploads/2011/05/thierry_fashiolista.png" alt="" width="499" height="284" /></p>
<p>In this blog post I will explain how to get started implementing a Facebook connect flow. Django Facebook can however do quite a bit more, as you can see in the feature list below. Development over at the <a href="https://github.com/tschellenbach/Django-facebook">github repo</a> is very active. I strongly appreciate help on improving the functionality so please fork and contribute.</p>
<p><b>Features</b></p>
<ul>
<li>Register users using the Facebook open graph API
<ul>
<li>Full profile data birthday, gender, website, about me, username, email and picture</li>
<li>Support for mobile authentication</li>
<li>Fallback to registration form for entering additional data when required</li>
</ul>
</li>
<li>Build Facebook Canvas applications</li>
<li>Mobile registration using Facebook</li>
<li>Execute Facebook FQL queries</li>
<li>Upload pictures to Facebook</li>
<li>Find your Facebook friends</li>
</ul>
<h3>Getting Started</h3>
<p>Now let&#8217;s get started with building a Facebook login/connect/register flow. This post will guide you through it step by step.</p>
<h4>Prerequisites</h4>
<p><a href="http://www.facebook.com/developers/createapp.php" target="_blank">Create a Facebook app</a></p>
<p><a href="https://bitbucket.org/ubernostrum/django-registration/" target="_blank">Have django registration installed</a> (other registration systems will require some small code changes)</p>
<p>pip install django_facebook :)</p>
<h4>A.) Settings and more</h4>
<p>Define these settings in your settings file.<br />
FACEBOOK_API_KEY<br />
FACEBOOK_APP_ID<br />
FACEBOOK_APP_SECRET</p>
<p>add django facebook to your installed apps<br />
&#8216;django_facebook&#8217;,<br />
add this line to your url config<br />
(r&#8217;^facebook/&#8217;, include(&#8216;django_facebook.urls&#8217;)),<br />
add this line to your context processors<br />
&#8216;django_facebook.context_processors.facebook&#8217;,<br />
add this to your AUTHENTICATION_BACKENDS<br />
&#8216;django_facebook.auth_backends.FacebookBackend&#8217;,</p>
<h4>B.) Adjust your user Profile model</h4>
<p>Secondly we need to be able to store the Facebook data on your user profile.<br />
The easiest way to do this is to add the abstract model in django_facebook/models.py called FacebookProfileModel to your profile model.<br />
After your profile is ready to store Facebook data you should have a working example at /facebook/connect/.<br />
Let me know in the comments if something went wrong up to this point :)</p>
<h4>C.) Design and integration</h4>
<p>You can style the facebook form and button anyway you see fit. <a href="http://www.fashiolista.com/intro_wide/">Over at Fashiolista</a> we added a nice facepile for example. The basic markup is located in the example file connect.html.<br />
We use the facebook javascript SDK for a smooth user integration. You can load the facebook JS like this:</p>
<pre class="javascript" name="code">&lt;script src="{{ MEDIA_URL }}js/original/facebook.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script&gt;
facebookAppId = '{{ FACEBOOK_APP_ID }}';
function facebookJSLoaded(){
FB.init({appId: facebookAppId, status: false, cookie: true, xfbml: true});
}
window.fbAsyncInit = facebookJSLoaded;
F = new facebookClass(facebookAppId);
F.load();
&lt;/script&gt;</pre>
<p>Subsequently implement a form which calls Facebook via javascript. Note that you can control which page to go to after connect using the next input field.</p>
<pre class="python" name="code">&lt;form action="{% url facebook_connect %}?facebook_login=1" method="post"&gt;
&lt;a href="javascript:void(0);" style="font-size: 20px;" onclick="F.connect(this.parentNode);"&gt;Register, login or connect with facebook&lt;/a&gt;
&lt;input type="hidden" value="{{ request.path }}" name="next" /&gt;
&lt;/form&gt;
&lt;div id="fb-root"&gt;&lt;/div&gt;</pre>
<p>That was all, you should now have a working registration flow using Facebook. Let me know in the comments if you encounter any difficulties.<br />
If you want to go one step further and understand the facebook API, you can find the <a href="http://developers.facebook.com/docs/">Facebook documentation here</a>.<br />
Django Facebook received tons of improvements from the python community. I&#8217;m certainly missing a few authors, but I would like to thank a few specifically:</p>
<p><strong>Many thanks to (amongst many others)</strong></p>
<ul>
<li><a href="http://gigantuan.net" target="_blank">Kenneth Love</a></li>
<li><a href="http://gc-taylor.com" target="_blank">Greg Taylor</a></li>
<li><a href="http://www.linkedin.com/pub/riccardo-magliocchetti/6/ba/105" target="_blank">Riccardo Magliocchetti</a></li>
<li><a href="http://djangopeople.net/kmike/" target="_blank">Mikhail Korobov</a></li>
<li>Simple Geebus</li>
<li><a href="http://twitter.com/jonrohan" target="_blank">Jon Rohan</a></li>
<li>Rick van Hattem</li>
<li><a href="http://www.stochastictechnologies.com" target="_blank">Stochastic Technologies</a></li>
<li><a href="https://simplegeo.com/" target="_blank">Simplegeo</a></li>
<li><a href="http://www.canb.net/" target="_blank">Can Burak Cilingir</a></li>
<li>zdexter</li>
<li><a href="http://apps.facebook.com/railroadempire" target="_blank">Michael Robellard</a></li>
<li><a href="https://github.com/ramiro" target="_blank">Ramiro Morales</a></li>
</ul>
<h3>More posts coming up</h3>
<ul>
<li>Building a facebook canvas app using Django Facebook</li>
<li>Find and invite friends using Django Facebook</li>
</ul>
<h3>We&#8217;re hiring!</h3>
<p>Do you also see the beauty in clean code? Are you experienced with high scalability web apps? Currently we&#8217;re looking for additional talent over at our Amsterdam office. Feel free to drop me a line at my personal email for more information: thierryschellenbach[at]gmail.com</p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F06%2F23%2Fdjango-facebook-2-0-integrating-facebook%2F&amp;title=Django%20Facebook%202.0%20-%20Integrating%20Facebook" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F06%2F23%2Fdjango-facebook-2-0-integrating-facebook%2F&amp;title=Django%20Facebook%202.0%20-%20Integrating%20Facebook" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F06%2F23%2Fdjango-facebook-2-0-integrating-facebook%2F&amp;title=Django%20Facebook%202.0%20-%20Integrating%20Facebook" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F06%2F23%2Fdjango-facebook-2-0-integrating-facebook%2F&amp;t=Django%20Facebook%202.0%20-%20Integrating%20Facebook" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F06%2F23%2Fdjango-facebook-2-0-integrating-facebook%2F&amp;title=Django%20Facebook%202.0%20-%20Integrating%20Facebook" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F06%2F23%2Fdjango-facebook-2-0-integrating-facebook%2F&amp;title=Django%20Facebook%202.0%20-%20Integrating%20Facebook" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/06/23/django-facebook-2-0-integrating-facebook/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Mock Django Request for testing</title>
		<link>http://www.mellowmorning.com/2011/04/18/mock-django-request-for-testing/</link>
		<comments>http://www.mellowmorning.com/2011/04/18/mock-django-request-for-testing/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 12:53:11 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=343</guid>
		<description><![CDATA[When testing your applications I sometimes find myself needing to mock a request object. Unfortunately it is quite hard to find a good fake request factory which mimics a normal request.
Django has a class included for this purpose called RequestFactory. However it doesn&#8217;t fake the session object, breaking most of my test code. To fix [...]]]></description>
			<content:encoded><![CDATA[<p>When testing your applications I sometimes find myself needing to mock a request object. Unfortunately it is quite hard to find a good fake request factory which mimics a normal request.</p>
<p>Django has a class included for this purpose called RequestFactory. However it doesn&#8217;t fake the session object, breaking most of my test code. To fix this I wrote a tiny snippet implementing the RequestFactory with session and user support. Hope it helps :)</p>
<pre class="python" name="code">
from django.core.handlers.base import BaseHandler
from django.test.client import RequestFactory

class RequestMock(RequestFactory):
    def request(self, **request):
        "Construct a generic request object."
        request = RequestFactory.request(self, **request)
        handler = BaseHandler()
        handler.load_middleware()
        for middleware_method in handler._request_middleware:
            if middleware_method(request):
                raise Exception("Couldn't create request mock object - "
                                "request middleware returned a response")
        return request
</pre>
<p><a href="https://gist.github.com/925270">See the gist here.</a></p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F04%2F18%2Fmock-django-request-for-testing%2F&amp;title=Mock%20Django%20Request%20for%20testing" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F04%2F18%2Fmock-django-request-for-testing%2F&amp;title=Mock%20Django%20Request%20for%20testing" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F04%2F18%2Fmock-django-request-for-testing%2F&amp;title=Mock%20Django%20Request%20for%20testing" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F04%2F18%2Fmock-django-request-for-testing%2F&amp;t=Mock%20Django%20Request%20for%20testing" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F04%2F18%2Fmock-django-request-for-testing%2F&amp;title=Mock%20Django%20Request%20for%20testing" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F04%2F18%2Fmock-django-request-for-testing%2F&amp;title=Mock%20Django%20Request%20for%20testing" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/04/18/mock-django-request-for-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fashiolista raises $500,000 from Atomico :)</title>
		<link>http://www.mellowmorning.com/2011/01/12/fashiolista-raises-500000-from-atomico/</link>
		<comments>http://www.mellowmorning.com/2011/01/12/fashiolista-raises-500000-from-atomico/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 16:20:49 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=332</guid>
		<description><![CDATA[Some good news while new code is compiling :)
Champagne moment over here!
TechCrunch &#8211; Fashiolista raises funding from Skype founders



Share and Enjoy:


	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>Some good news while new code is compiling :)<br />
Champagne moment over here!</p>
<p><a href="http://eu.techcrunch.com/2011/01/12/online-fashion-community-fashiolista-raises-500000-from-atomico/">TechCrunch &#8211; Fashiolista raises funding from Skype founders</a></p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F01%2F12%2Ffashiolista-raises-500000-from-atomico%2F&amp;title=Fashiolista%20raises%20%24500%2C000%20from%20Atomico%20%3A%29" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F01%2F12%2Ffashiolista-raises-500000-from-atomico%2F&amp;title=Fashiolista%20raises%20%24500%2C000%20from%20Atomico%20%3A%29" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F01%2F12%2Ffashiolista-raises-500000-from-atomico%2F&amp;title=Fashiolista%20raises%20%24500%2C000%20from%20Atomico%20%3A%29" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F01%2F12%2Ffashiolista-raises-500000-from-atomico%2F&amp;t=Fashiolista%20raises%20%24500%2C000%20from%20Atomico%20%3A%29" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F01%2F12%2Ffashiolista-raises-500000-from-atomico%2F&amp;title=Fashiolista%20raises%20%24500%2C000%20from%20Atomico%20%3A%29" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2011%2F01%2F12%2Ffashiolista-raises-500000-from-atomico%2F&amp;title=Fashiolista%20raises%20%24500%2C000%20from%20Atomico%20%3A%29" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2011/01/12/fashiolista-raises-500000-from-atomico/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mixing Django with Jinja2 without losing template debugging</title>
		<link>http://www.mellowmorning.com/2010/08/24/mixing-django-with-jinja2-without-losing-template-debugging/</link>
		<comments>http://www.mellowmorning.com/2010/08/24/mixing-django-with-jinja2-without-losing-template-debugging/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 01:26:39 +0000</pubDate>
		<dc:creator>Rick van Hattem</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Jinja2]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=321</guid>
		<description><![CDATA[At Fashiolista we&#8217;ve build nearly the entire site with Jinja instead of the Django template engine.
There are a lot of reasons for choosing Jinja2 over Django for us. Better performance (atleast&#8230; it was a lot better with previous Django versions), way more options (named arguments, multiple arguments for filters, etc), macros and simply easier to [...]]]></description>
			<content:encoded><![CDATA[<p>At Fashiolista we&#8217;ve build nearly the entire site with Jinja instead of the Django template engine.</p>
<p>There are a lot of reasons for choosing Jinja2 over Django for us. Better performance (atleast&#8230; it was a lot better with previous Django versions), way more options (named arguments, multiple arguments for filters, etc), macros and simply easier to extend. Writing custom tags is simply not needed anymore since you can just make any function callable from the templates.</p>
<p>But&#8230; during the conversion there are always moments when you need  a Django function in a Jinja template or vice versa. So&#8230; I created a few template tags to allow for Jinja code in Django templates (I&#8217;ve also created code to run Django code from Jinja, but I haven&#8217;t seen the need for it so I omitted it here).</p>
<p>A Jinja Include tag to include a template and let it be parsed by Jinja from a Django template:</p>
<pre class="python" name="code">from django import template
from coffin import shortcuts as jinja_shortcuts                                                                                                                                                      

register = template.Library()                                                                                                                                                                        

class JinjaInclude(template.Node):
    def __init__(self, filename):
        self.filename = filename                                                                                                                                                                     

    def render(self, context):
        return jinja_shortcuts.render_to_string(self.filename, context)                                                                                                                              

@register.tag
def jinja_include(parser, token):
    bits = token.contents.split()                                                                                                                                                                    

    '''Check if a filename was given'''
    if len(bits) != 2:
        raise template.TemplateSyntaxError('%r tag requires the name of the '
            'template to be included included ' % bits[0])
    filename = bits[1]                                                                                                                                                                               

    '''Remove quotes if used'''
    if filename[0] in ('"', "'") and filename[-1] == filename[0]:
        filename = bits[1:-1]                                                                                                                                                                        

    return JinjaInclude(filename)</pre>
<p>Usage:</p>
<pre class="javascript" name="code">{% jinja_include "some_template.html" %}</pre>
<p>A couple of noop nodes to make sure that when you convert your Jinja templates to be executed from Django, they won&#8217;t break because of the missing Django tag.</p>
<pre class="python" name="code">from django import template

class Empty(template.Node):
    def render(self, context):
        return ''                                                                                                                                                                                    

@register.tag
def django(parser, token):
    return Empty()                                                                                                                                                                                   

@register.tag
def end_django(parser, token):
    return Empty()</pre>
<p>And the Jinja tag to allow Jinja blocks in Django templates.</p>
<pre class="python" name="code">from django import template
from coffin.template import Template

register = template.Library()

class Jinja(template.Node):
    def __init__(self, template):
        self.template = template                                                                                                                                                                     

    def render(self, context):
        return self.template.render(context)                                                                                                                                                         

@register.tag
def jinja(parser, token):
    '''Create a Jinja template block                                                                                                                                                                 

    Usage:
    {% jinja %}
    Although you're in a Django template, code here will be executed by Jinja
    {% end_jinja %}
    '''                                                                                                                                                                                              

    '''Generate the end tag from the currently used tag name'''
    end_tag = 'end_%s' % token.contents.split()[0]                                                                                                                                                   

    tokens = []
    '''Convert all tokens to the string representation of them
    That way we can keep Django template debugging with Jinja and feed the
    entire string to Jinja'''
    while parser.tokens:
        token = parser.next_token()
        if token.token_type == template.TOKEN_TEXT:
            tokens.append(token.contents)                                                                                                                                                            

        elif token.token_type == template.TOKEN_VAR:
            tokens.append(' '.join((
                template.VARIABLE_TAG_START,
                token.contents,
                template.VARIABLE_TAG_END,
            )))                                                                                                                                                                                      

        elif token.token_type == template.TOKEN_BLOCK:
            if token.contents == end_tag:
                break                                                                                                                                                                                

            tokens.append(' '.join((
                template.BLOCK_TAG_START,
                token.contents,
                template.BLOCK_TAG_END,
            )))                                                                                                                                                                                      

        elif token.token_type == template.TOKEN_COMMENT:
            pass                                                                                                                                                                                     

        else:
            raise template.TemplateSyntaxError('Unknown token type: "%s"' % token.token_type)                                                                                                        

    '''If our token has a `source` attribute than template_debugging is
    enabled. If it's enabled create a valid source attribute for the Django
    template debugger'''
    if hasattr(token, 'source'):
        source = token.source[0], (token.source[1][0], token.source[1][1])
    else:
        source = None                                                                                                                                                                                

    return Jinja(Template(''.join(tokens), source=source))</pre>
<p>Do note that I have modified the &#8220;coffin.template.Template&#8221; to enable debugging completely. Just replace the &#8220;Template&#8221; class in &#8220;coffin/template/__init__.py&#8221; to make it work.</p>
<pre class="python" name="code">def _generate_django_exception(e, source=None):
    '''Generate a Django exception from a Jinja source'''
    from django.views.debug import linebreak_iter                                                                                                                                                    

    if source:
        exception = DjangoTemplateSyntaxError(e.message)
        exception_dict = e.__dict__
        del exception_dict['source']                                                                                                                                                                 

        '''Fetch the entire template in a string'''
        template_string = source[0].reload()                                                                                                                                                         

        '''Get the line number from the error message, if available'''
        match = re.match('.* at (\d+)$', e.message)                                                                                                                                                  

        start_index = 0
        stop_index = 0
        if match:
            '''Convert the position found in the stacktrace to a position
            the Django template debug system can use'''
            position = int(match.group(1)) + source[1][0] + 1                                                                                                                                        

            for index in linebreak_iter(template_string):
                if index &gt;= position:
                    stop_index = min(index, position + 3)
                    start_index = min(index, position - 2)
                    break
                start_index = index                                                                                                                                                                  

        else:
            '''So there wasn't a matching error message, in that case we
            simply have to highlight the entire line instead of the specific
            words'''
            ignore_lines = 0
            for i, index in enumerate(linebreak_iter(template_string)):
                if source[1][0] &gt; index:
                    ignore_lines += 1                                                                                                                                                                

                if i - ignore_lines == e.lineno:
                    stop_index = index
                    break                                                                                                                                                                            

                start_index = index                                                                                                                                                                  

        '''Convert the positions to a source that is compatible with the
        Django template debugger'''
        source = source[0], (
            start_index,
            stop_index,
        )
    else:
        '''No source available so we let Django fetch it for us'''
        lineno = e.lineno - 1
        template_string, source = django_loader.find_template_source(e.name)
        exception = DjangoTemplateSyntaxError(e.message)                                                                                                                                             

        '''Find the positions by the line number given in the exception'''
        start_index = 0
        for i in range(lineno):
            start_index = template_string.index('\n', start_index + 1)                                                                                                                               

        source = source, (
            start_index + 1,
            template_string.index('\n', start_index + 1) + 1,
        )                                                                                                                                                                                            

    exception.source = source
    return exception          

class Template(_Jinja2Template):
    """Fixes the incompabilites between Jinja2's template class and
    Django's.                                                                                                                                                                                        

    The end result should be a class that renders Jinja2 templates but
    is compatible with the interface specfied by Django.                                                                                                                                             

    This includes flattening a ``Context`` instance passed to render
    and making sure that this class will automatically use the global
    coffin environment.
    """                                                                                                                                                                                              

    def __new__(cls, template_string, origin=None, name=None, source=None):
        # We accept the "origin" and "name" arguments, but discard them
        # right away - Jinja's Template class (apparently) stores no
        # equivalent information.
        from coffin.common import env                                                                                                                                                                

        try:
            return env.from_string(template_string, template_class=cls)
        except JinjaTemplateSyntaxError, e:
            raise _generate_django_exception(e, source)                                                                                                                                              

    def __iter__(self):
        # TODO: Django allows iterating over the templates nodes. Should
        # be parse ourself and iterate over the AST?
        raise NotImplementedError()                                                                                                                                                                  

    def render(self, context=None):
        """Differs from Django's own render() slightly in that makes the
        ``context`` parameter optional. We try to strike a middle ground
        here between implementing Django's interface while still supporting
        Jinja's own call syntax as well.
        """
        if not context:
            context = {}
        else:
            context = dict_from_django_context(context)                                                                                                                                              

        try:
            return super(Template, self).render(context)
        except JinjaTemplateSyntaxError, e:
            raise _generate_django_exception(e)                                                                                                                                                      

def dict_from_django_context(context):
    """Flattens a Django :class:`django.template.context.Context` object.
    """
    if isinstance(context, DjangoContext):
        dict_ = {}
        # Newest dicts are up front, so update from oldest to newest.
        for subcontext in reversed(list(context)):
            dict_.update(dict_from_django_context(subcontext))
        return dict_
    else:
        return context</pre>
<p>And you&#8217;re done, now you can just mix your Django and Jinja templates like this:</p>
<pre class="javascript" name="code">{% ifequal foo bar %}
Django style if...
{% endif %}

{% jinja %}
{% if foo == bar %}
Jinja style if...
{% endif %}
{% end_jinja %}
</pre>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F24%2Fmixing-django-with-jinja2-without-losing-template-debugging%2F&amp;title=Mixing%20Django%20with%20Jinja2%20without%20losing%20template%20debugging" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F24%2Fmixing-django-with-jinja2-without-losing-template-debugging%2F&amp;title=Mixing%20Django%20with%20Jinja2%20without%20losing%20template%20debugging" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F24%2Fmixing-django-with-jinja2-without-losing-template-debugging%2F&amp;title=Mixing%20Django%20with%20Jinja2%20without%20losing%20template%20debugging" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F24%2Fmixing-django-with-jinja2-without-losing-template-debugging%2F&amp;t=Mixing%20Django%20with%20Jinja2%20without%20losing%20template%20debugging" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F24%2Fmixing-django-with-jinja2-without-losing-template-debugging%2F&amp;title=Mixing%20Django%20with%20Jinja2%20without%20losing%20template%20debugging" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F24%2Fmixing-django-with-jinja2-without-losing-template-debugging%2F&amp;title=Mixing%20Django%20with%20Jinja2%20without%20losing%20template%20debugging" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2010/08/24/mixing-django-with-jinja2-without-losing-template-debugging/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Twitter button to pull down the internet?</title>
		<link>http://www.mellowmorning.com/2010/08/13/twitter-button-to-pull-down-the-internet/</link>
		<comments>http://www.mellowmorning.com/2010/08/13/twitter-button-to-pull-down-the-internet/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 14:39:10 +0000</pubDate>
		<dc:creator>tschellenbach</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Fashiolista]]></category>
		<category><![CDATA[Google app engine]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[YouTellMe]]></category>

		<guid isPermaLink="false">http://www.mellowmorning.com/?p=308</guid>
		<description><![CDATA[I was thrilled to see twitter releasing their own button. This is good news all around for us bloggers looking to promote our content. After looking at their code snippets a warning is in place though. The current twitter button implementation will severely break your site if their servers face load issues. Fortunately you can [...]]]></description>
			<content:encoded><![CDATA[<p>I was thrilled to see <a target="_blank" href="http://mashable.com/2010/08/13/tweet-button-bloggers/">twitter releasing their own button</a>. This is <a target="_blank" href="http://techcrunch.com/2010/08/12/twitter-tweet-button/">good news</a> all around for us bloggers looking to promote our content. After looking at their code snippets a warning is in place though. The current twitter button implementation will severely break your site if their servers face load issues. Fortunately you can work around this issues by slightly modifying their implementation.</p>
<h3>Technical explanation</h3>
<p>For <a  target="_blank"  href="http://www.fashiolista.com/">Fashiolista.com</a> we have been writing a lot about the <a target="_blank" href="http://www.mellowmorning.com/2010/08/03/creating-your-own-diggfacebook-liketweetmeme-button/">various techniques</a> for implementing these type of buttons. Especially important here is the way the javascript is loaded. Twitter uses a simple blocking script approach, where as digg, facebook and fashiolista use the async dynamic script approach. There are two large differences:</p>
<ol>
<li>Blocking script loads make your site slower</li>
<li>If twitter goes down, your site joins in</li>
</ol>
<h3>Example</h3>
<p>In this example we are faking slow twitter servers. (By routing it through google&#8217;s app engine and delaying the response). You can see the difference for yourself (be patient and be sure to clear your browser cache using CTRL F5).</p>
<p><a  target="_blank"  href="http://static1.fashiolista.com/other/button_twitter_fail.html">Default twitter version</a><br />
(note that site content is not loading until the twitter button is loaded)</p>
<p><a  target="_blank"  href="http://static1.fashiolista.com/other/button_twitter.html">Async twitter script</a><br />
(everything loads and then we wait for twitter)</p>
<h3>Solution</h3>
<p>Solving this is quite simple. Simply change the way the twitter javascript is loaded from the first example to the second version.</p>
<p><strong>Twitter version</strong></p>
<pre code="javascript" name="code">

&lt;script type=&quot;text/javascript&quot; src=&quot;http://platform.twitter.com/widgets.js&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>Async twitter implementation</strong></p>
<pre code="javascript" name="code">
&lt;script type=&quot;text/javascript&quot;&gt;
  //async script, twitter button fashiolista.com style
  (function() {
   var s = document.createElement('SCRIPT');
   var c = document.getElementsByTagName('script')[0];
   s.type = 'text/javascript';
   s.async = true;
   s.src = 'http://platform.twitter.com/widgets.js';
   c.parentNode.insertBefore(s, c);
  })();
&lt;/script&gt;
</pre>
<p>Hope the difference won&#8217;t matter and Twitter will stay up :)</p>
<p>Follow me at:<br />
<a target="_blank" href="http://twitter.com/tschellenbach">@tschellenbach</a></p>
<p>Thanks for spreading the word:<br />
<a href="http://thenextweb.com/socialmedia/2010/08/13/the-twitter-button-is-it-making-your-site-join-the-fail-whale-shuffle/">NextWeb</a></p>



Share and Enjoy:


	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F13%2Ftwitter-button-to-pull-down-the-internet%2F&amp;title=Twitter%20button%20to%20pull%20down%20the%20internet%3F" title="Digg"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F13%2Ftwitter-button-to-pull-down-the-internet%2F&amp;title=Twitter%20button%20to%20pull%20down%20the%20internet%3F" title="Sphinn"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F13%2Ftwitter-button-to-pull-down-the-internet%2F&amp;title=Twitter%20button%20to%20pull%20down%20the%20internet%3F" title="del.icio.us"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F13%2Ftwitter-button-to-pull-down-the-internet%2F&amp;t=Twitter%20button%20to%20pull%20down%20the%20internet%3F" title="Facebook"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F13%2Ftwitter-button-to-pull-down-the-internet%2F&amp;title=Twitter%20button%20to%20pull%20down%20the%20internet%3F" title="Mixx"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mellowmorning.com%2F2010%2F08%2F13%2Ftwitter-button-to-pull-down-the-internet%2F&amp;title=Twitter%20button%20to%20pull%20down%20the%20internet%3F" title="Google"><img src="http://www.mellowmorning.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mellowmorning.com/2010/08/13/twitter-button-to-pull-down-the-internet/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
