<?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>muhuk.com &#187; python</title>
	<atom:link href="http://www.muhuk.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.muhuk.com</link>
	<description>know thyself</description>
	<lastBuildDate>Thu, 29 Dec 2011 05:05:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Working with files in Django &#8211; Part 3</title>
		<link>http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=working-with-files-in-django-part-3</link>
		<comments>http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 00:02:14 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=463</guid>
		<description><![CDATA[First part of this article is here. How to add STATIC files You will most likely add STATIC files to your source code repository. As they are likely to be hardcoded in your code and templates it is a good idea to keep those and your STATIC files in sync. Your STATIC files are collected [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' addthis:title='Working with files in Django &#8211; Part 3 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p><small>First part of this article is <a href="http://www.muhuk.com/2011/11/working-with-files-in-django/">here</a>.</small></p>

<h2>How to add STATIC files</h2>

<p>You will most likely add <code>STATIC</code> files to your source code repository. As they are likely to be hardcoded in your code and templates it is a good idea to keep those and your <code>STATIC</code> files in sync.</p>

<p>Your <code>STATIC</code> files are collected (found and copied or symlinked) with the help of <a href="https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/#staticfiles-finders">finders</a>. This <em>collection</em> process might be a little confusing for you. Basically you don&#8217;t need to worry about where your files are copied, you just need to maintain the files in the locations I mention below. Collection process consolidates all your <code>STATIC</code> files for you, and it does it automatically.</p>

<p>If you are developing a reusable app place your <code>STATIC</code> files under the <code>static</code> directory. Your app directory should look like this:</p>

<pre><code>$ ls -1
models.py
static/
templates/
views.py
</code></pre>

<p>If you are developing a project absolute filesystem paths listed in your <code>STATICFILES_DIRS</code> setting will be collected:</p>

<pre><code>&gt;&gt;&gt; from django.conf import settings
&gt;&gt;&gt; settings.STATICFILES_DIRS
('/opt/myproject/src/project/static',)
</code></pre>

<p>One important thing to note, as I mentioned in the first part, is to set your <code>STATIC_ROOT</code> outside of your project directory. This is the location where all the <code>STATIC</code> files found will be consolidated. Making this directory independent from your project installation enabled its reuse.</p>

<h2>How to upload MEDIA files</h2>

<p>MEDIA files are typically uploaded by users when the project is online and a reference is stored in a model field. While this is true most of the time, <code>MEDIA</code> files can be generated by code and/or a reference can be provided in some other way that doesn&#8217;t involve models. But these edge cases are out of the scope of this post.</p>

<p>The easiest way to allow users upload their files is to use a <a href="https://docs.djangoproject.com/en/1.3/ref/models/fields/#filefield">FileField</a> or <a href="https://docs.djangoproject.com/en/1.3/ref/models/fields/#imagefield">ImageField</a> on a model and <a href="https://docs.djangoproject.com/en/dev/topics/forms/modelforms/">derive a form</a> from it:</p>

<pre><code>from django.db import models
from django.forms.models import modelform_factory


class MediaModel(models.Model):
    media_file = models.FileField(upload_to='user_media')


MediaForm = modelform_factory(MediaModel)
</code></pre>

<p>You can then use this form to provide upload functionality:</p>

<pre><code>def media_create(request):
    if request.method == "POST":
        form = MediaForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('media-list'))
    else:
        form = MediaForm()
    return render_to_response('usermedia/create/html', {'form': form})
</code></pre>

<p>Of course it is better to use a generic <a href="https://docs.djangoproject.com/en/1.3/ref/class-based-views/#createview">CreateView</a> now we have them with Django 1.3. I wanted to emphasize one point and avoid the complexities of a class based view; you must pass <code>request.FILES</code> to the form&#8217;s constructor. Actually this is a good practice whether or not your form has an file field.</p>

<p>As in the case with <code>STATIC</code> files, <code>MEDIA_ROOT</code> should be in a location seperate from your project files. If you delete your project directory you would also lose <code>MEDIA</code> files otherwise.</p>

<h2>Conclusion</h2>

<p>This concludes <a href="">Working with files in Django</a>. I hope these posts are helpful to you. Once you are comfortable working with files I strongly recommend you to take a look at <a href="http://django_compressor.readthedocs.org/en/latest/index.html">Django Compressor</a></p>

<p><small>If you enjoyed this post please <a href="http://www.muhuk.com/about-you/">tell me a little bit about yourself</a>.</small></p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' addthis:title='Working with files in Django &#8211; Part 3 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
<li><a href='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' rel='bookmark' title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor'>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=463&amp;md5=690eb5cb2faa6e3c87eab634b34a4348" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=463&amp;md5=690eb5cb2faa6e3c87eab634b34a4348" type="text/html" />
	</item>
		<item>
		<title>Working with files in Django &#8211; Part 2</title>
		<link>http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=working-with-files-in-django-part-2</link>
		<comments>http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 08:31:08 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=461</guid>
		<description><![CDATA[First part of this article is here. How to setup file serving for development server As I mentioned earlier, it is best to serve files on a fast HTTP server. But this setup is overkill for development environments, you can safely let Django handle your files. The snippet below relies on the assumption, behind the [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' addthis:title='Working with files in Django &#8211; Part 2 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p><small>First part of this article is <a href="http://www.muhuk.com/2011/11/working-with-files-in-django/">here</a>.</small></p>

<h2>How to setup file serving for development server</h2>

<p>As I mentioned earlier, it is best to serve files on a fast HTTP server. But this setup is overkill for development environments, you can safely let Django handle your files. The snippet below relies on the assumption, behind the scenes, that <code>DEBUG</code> is always <code>True</code> in development environment and it is always <code>False</code> in production environment. It should be fine for the purposes of this post:</p>

<pre><code>from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()
</code></pre>

<p>It is quite straightforward. Nothing gets added to <code>urlpatterns</code> unless <code>DEBUG</code> is <code>True</code> <strong>and</strong> prefix (<code>MEDIA_URL</code> and <code>STATIC_URL</code>) is not a fully qualified URL.</p>

<h2>How to reference <code>STATIC</code> files in templates</h2>

<p>There are two ways to reference any file. You can use a file&#8217;s location in your file storage (your filesystem for example) for internal use. Or you can build a URL for the file so that clients can access it. This post will cover the latter, as the former is a simple matter of applying <code>os.path.join()</code> to <code>STATIC_ROOT</code> and the particular file&#8217;s path.</p>

<p>To build a URL in your templates you can simply concetenate <code>STATIC_URL</code> with the file&#8217;s relative location to it:</p>

<pre><code>&lt;img src="{{ STATIC_URL }}myapp/img/logo.png" /&gt;
</code></pre>

<p>However, to have <code>STATIC_URL</code> available within your template context you need to make sure of two things:</p>

<ul>
<li>The template needs to be rendered with a <a href="https://docs.djangoproject.com/en/1.3/ref/templates/api/#django.template.RequestContext">RequestContext</a>.</li>
<li><code>django.core.context_processors.static</code> needs to be included in <code>TEMPLATE_CONTEXT_PROCESSORS</code> setting.</li>
</ul>

<p>I can&#8217;t think of a reason why, but if for some reason you are not using <code>RequestContext</code>, you can provide <code>STATIC_URL</code> using <a href="https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/#the-get-static-prefix-templatetag">get<em>static</em>prefix</a> tag:</p>

<pre><code>{% load static %}
{% get_static_prefix as STATIC_URL %}

&lt;img src="{{ STATIC_URL }}myapp/img/logo.png" /&gt;
</code></pre>

<h2>How to reference MEDIA files in templates</h2>

<p>Dealing with <code>MEDIA</code> files is much simpler. The <code>FieldFile</code> object returned by <code>ImageField</code> and <code>FileField</code> has <code>path</code> and <code>url</code> properties and you don&#8217;t need to do concetenation yourself:</p>

<pre><code>&lt;img src="{{ some_model.some_image_field.url }}" /&gt;
</code></pre>

<p><small><a href="http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/">Next part</a> deals with adding files to your project.</small></p>

<p><small>If you enjoyed this post please <a href="http://www.muhuk.com/about-you/">tell me a little bit about yourself</a>.</small></p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' addthis:title='Working with files in Django &#8211; Part 2 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' rel='bookmark' title='Working with files in Django &#8211; Part 3'>Working with files in Django &#8211; Part 3</a></li>
<li><a href='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' rel='bookmark' title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor'>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=461&amp;md5=44a4b62c499b1c44896e9f38748575eb" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=461&amp;md5=44a4b62c499b1c44896e9f38748575eb" type="text/html" />
	</item>
		<item>
		<title>Working with files in Django &#8211; Part 1</title>
		<link>http://www.muhuk.com/2011/11/working-with-files-in-django/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=working-with-files-in-django</link>
		<comments>http://www.muhuk.com/2011/11/working-with-files-in-django/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 10:47:18 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=453</guid>
		<description><![CDATA[In this post what I mean by file is any content that is not dynamically generated. There are basically two types of files a web application deals with: Files that are hard coded in templates or in code. We will call them STATIC files. Files that are referenced in the code but only known in [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/11/working-with-files-in-django/' addthis:title='Working with files in Django &#8211; Part 1 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>In this post what I mean by <code>file</code> is any content that is not dynamically generated. There are basically two types of files a web application deals with:</p>

<ul>
<li>Files that are hard coded in templates or in code. We will call them <code>STATIC</code> files.</li>
<li>Files that are referenced in the code but only known in the run time. We will call them <code>MEDIA</code> files.</li>
</ul>

<p>Now of course all these files are static and most of them can be classified as media, but I chose those terms because that more or less how they are referred to in <a href="https://docs.djangoproject.com/en/1.3/">Django documentation</a>.</p>

<p>Since files are stored on disk or some other <a href="https://docs.djangoproject.com/en/1.3/ref/files/storage/">storage backend</a> it is best to <a href="https://docs.djangoproject.com/en/1.3/howto/static-files/#serving-static-files-from-a-dedicated-server">serve them on a fast HTTP server</a> and let Django handle only dynamic content.</p>

<h2>How to configure STATIC/MEDIA related settings</h2>

<p>Let&#8217;s look at some code first and we can comment on it afterwards. I use the following setup in my projects:</p>

<pre><code>import os

_PATH = os.path.abspath(os.path.dirname(__file__))

MEDIA_ROOT = os.path.join(_PATH, 'files', 'media')
MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(_PATH, 'files', 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(_PATH, 'static'),
)
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

ADMIN_MEDIA_PREFIX = '/static/admin/'
</code></pre>

<p><code>_PATH</code> should be obvious. But the way I use it is a little tricky here. Basically I am using a <code>files</code> directory that contains <code>media</code>, for <code>MEDIA</code> files, and <code>static</code>, for <code>STATIC</code> files, directories. This seperation is essential. You will pull your hair if you don&#8217;t seperate those two from the beginning. This will allow you to reuse them easily if you deploy a new version to a different location.</p>

<p>But why is <code>files</code> under the project directory? Because we need to check-in <code>STATIC</code> files? NO! It is just a convenience for the development environments. I strongly suggest overriding <code>MEDIA_ROOT</code> and <code>STATIC_ROOT</code> in your deployment settings and basically move the <code>files</code> directory outside of the project path. <code>STATIC</code> files that we check-in resides in <code>&lt;_PATH&gt;/static</code>. <a href="https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/"><code>django.contrib.staticfiles</code></a> app collects your <code>STATIC</code> files from your project specific directories and within your apps and copies everything in the right places inside <code>STATIC_ROOT</code>.</p>

<p>To sum up the points above:</p>

<ul>
<li>Check-in <code>STATIC</code> files in a folder within your project directory (see <code>STATICFILES_DIRS</code> &amp; <code>FileSystemFinder</code>). If you are <a href="http://www.muhuk.com/2010/01/developing-reusable-django-apps/">developing an app</a> <code>AppDirectoriesFinder</code> will collect static files within the <code>static</code> directory in your app directory.</li>
<li>Seperate the directories, where your <code>MEDIA</code> files are saved and where your <code>STATIC</code> files are collected (see <code>STATIC_ROOT</code> &amp; <code>MEDIA_ROOT</code>).</li>
<li>Keep your <code>STATIC_ROOT</code> and <code>MEDIA_ROOT</code> outside of your project directory in production environment.</li>
</ul>

<p>One more thing to note is <code>STATIC_URL</code> and <code>MEDIA_URL</code> should both have a trailing slash. This will save you a lot of trouble later.</p>

<p><small><a href="http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/">Next part</a> deals with serving files in development environment and referencing them in code and templates.</small></p>

<p><small>If you enjoyed this post please <a href="http://www.muhuk.com/about-you/">tell me a little bit about yourself</a>.</small></p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/11/working-with-files-in-django/' addthis:title='Working with files in Django &#8211; Part 1 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' rel='bookmark' title='Working with files in Django &#8211; Part 3'>Working with files in Django &#8211; Part 3</a></li>
<li><a href='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' rel='bookmark' title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor'>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=453&amp;md5=f0a4d9fd68404a3679f5ab10b5700a81" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2011/11/working-with-files-in-django/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=453&amp;md5=f0a4d9fd68404a3679f5ab10b5700a81" type="text/html" />
	</item>
		<item>
		<title>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</title>
		<link>http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pycon-apac-optimizing-media-performance-with-django_compressor</link>
		<comments>http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 09:41:45 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=416</guid>
		<description><![CDATA[I have given a presentation about django_compressor at PyCon APAC 2011. Slides are below for everyone to see: Optimizing Media Performance with django_compressor View more presentations from muhuk Related posts: Working with files in Django &#8211; Part 1 Working with files in Django &#8211; Part 2 Working with files in Django &#8211; Part 3<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' addthis:title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>I have given a presentation about <a href="http://django_compressor.readthedocs.org/">django_compressor</a> at <a href="http://apac.pycon.org/">PyCon APAC 2011</a>. Slides are below for everyone to see:</p>

<div style="width:425px" id="__ss_8387857"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/muhuk/optimizing-media-performance-with-djangocompressor" title="Optimizing Media Performance with django_compressor">Optimizing Media Performance with django_compressor</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/8387857" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> <div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/muhuk">muhuk</a> </div> </div>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' addthis:title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' rel='bookmark' title='Working with files in Django &#8211; Part 3'>Working with files in Django &#8211; Part 3</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=416&amp;md5=27d75947771a44d9ca505fe4b3865437" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=416&amp;md5=27d75947771a44d9ca505fe4b3865437" type="text/html" />
	</item>
		<item>
		<title>Drawing Gradients with PyGame</title>
		<link>http://www.muhuk.com/2010/11/drawing-gradients-with-pygame/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drawing-gradients-with-pygame</link>
		<comments>http://www.muhuk.com/2010/11/drawing-gradients-with-pygame/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 06:20:11 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[gradient]]></category>
		<category><![CDATA[pygame]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=394</guid>
		<description><![CDATA[I have been learning myself some PyGame on my free time. Best way to learn new technologies, I believe, is to develop small project and doing a lot of reading. Everybody seems to agree on the former but most fail to put effort doing the latter. I needed to draw gradients for the background of [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/11/drawing-gradients-with-pygame/' addthis:title='Drawing Gradients with PyGame '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>I have been learning myself some <a href="http://www.pygame.org/">PyGame</a> on my free time. Best way to learn new technologies, I believe, is to develop small project <strong>and</strong> doing a lot of reading. Everybody seems to agree on the former but most fail to put effort doing the latter.</p>

<p>I needed to draw gradients for the background of my little learning project. First I tried the naive approach: iterating over each pixel and setting the correct value. This takes forever as you could have guessed. I continued my research to find out the close connection between PyGame and <a href="http://numpy.scipy.org/">NumPy</a>. Yes, fast array operations. My gradient generating code using <code>linspace</code> and <code>tile</code> is below:</p>

<p><code><pre style="color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';"><span style="color:#000000; font-weight:bold">def</span> <span style="color:#010181">generate&#95;gradient</span><span style="color:#000000">(</span>from<em>color<span style="color:#000000">,</span> to</em>color<span style="color:#000000">,</span> height<span style="color:#000000">,</span> width<span style="color:#000000">):</span>
    channels <span style="color:#000000">= []</span>
    <span style="color:#000000; font-weight:bold">for</span> channel <span style="color:#000000; font-weight:bold">in</span> <span style="color:#830000">range</span><span style="color:#000000">(</span><span style="color:#2928ff">3</span><span style="color:#000000">):</span>
        from<em>value<span style="color:#000000">,</span> to</em>value <span style="color:#000000">=</span> from<em>color<span style="color:#000000">[</span>channel<span style="color:#000000">],</span> to</em>color<span style="color:#000000">[</span>channel<span style="color:#000000">]</span>
        channels<span style="color:#000000">.</span><span style="color:#010181">append</span><span style="color:#000000">(</span>numpy<span style="color:#000000">.</span><span style="color:#010181">tile</span><span style="color:#000000">(</span>numpy<span style="color:#000000">.</span><span style="color:#010181">linspace</span><span style="color:#000000">(</span>from<em>value<span style="color:#000000">,</span> to</em>value<span style="color:#000000">,</span> width<span style="color:#000000">),</span>
                                                                  <span style="color:#000000">[</span>height<span style="color:#000000">,</span> <span style="color:#2928ff">1</span><span style="color:#000000">]))</span>
    <span style="color:#000000; font-weight:bold">return</span> numpy<span style="color:#000000">.</span><span style="color:#010181">dstack</span><span style="color:#000000">(</span>channels<span style="color:#000000">)</span>
</pre></code></p>

<p>I create three 1D arrays for each channel and then tile them to get a 2D array. Then I stack those 2D arrays and get combined <code>(r, g, b)</code> values. Each 1D array contain values linearly sampled between given maximum and minimum values by <code>linspace</code>. I can then blip this array on a surface like this:</p>

<p><code><pre style="color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';">gradient <span style="color:#000000">=</span> <span style="color:#010181">generate&#95;gradient</span><span style="color:#000000">((</span><span style="color:#2928ff">63</span><span style="color:#000000">,</span> <span style="color:#2928ff">95</span><span style="color:#000000">,</span> <span style="color:#2928ff">127</span><span style="color:#000000">), (</span><span style="color:#2928ff">195</span><span style="color:#000000">,</span> <span style="color:#2928ff">195</span><span style="color:#000000">,</span> <span style="color:#2928ff">255</span><span style="color:#000000">),</span> 1024<span style="color:#000000">,</span> 600<span style="color:#000000">)</span>
pygame<span style="color:#000000">.</span>surfarray<span style="color:#000000">.</span><span style="color:#010181">blit&#95;array</span><span style="color:#000000">(</span>some&#95;surface<span style="color:#000000">,</span> pygame<span style="color:#000000">.</span>surfarray<span style="color:#000000">.</span><span style="color:#010181">map&#95;array</span><span style="color:#000000">(</span>some&#95;surface<span style="color:#000000">,</span> gradient<span style="color:#000000">))</span>
</pre></code></p>

<p>This works quite well. But I was curious whether there is a better method, so I did some googling. First I stumbled upon James Tauber&#8217;s <a href="http://jtauber.com/blog/2008/05/18/creating_gradients_programmatically_in_python/">gradient code</a>. Arrays! I was a bit ashamed not remembering standard library had <a href="http://docs.python.org/release/2.6.5/library/array.html">array</a> module. James Tauber&#8217;s code builds an array with the correct values and then writes the image as a PNG file. It also has the ability to generate multi-gradients.</p>

<p>Then I found <a href="http://www.pygame.org/project-gradients-307-1586.html">gradients</a> package for PyGame. This package does much more than linear gradients. It creates a PyGame surface of 1 pixel thickness, fills it with the gradient values and then resizes it.</p>

<p>I made a small test to see which method runs faster. I had to strip file and compression related code from James Tauber&#8217;s gradient module. I run a simple method tha just generates a gradient image/array in memory and returns it 10 time, below is the average times:</p>

<ul>
<li>320&#215;240:

<ul>
<li>numpy: 0.01469659805</li>
<li>array: 3.6310561180</li>
<li>pygame: 0.0069756984711</li>
</ul></li>
<li>800&#215;600:

<ul>
<li>numpy: 0.1323119163</li>
<li>array: 19.9719331265</li>
<li>pygame: 0.0192141056061</li>
</ul></li>
</ul>

<p>Here <code>numpy</code> is my method above, <code>array</code> is the stripped version of James Tauber&#8217;s code and <code>pygame</code> is the gradiends package. If my benchmarking method doesn&#8217;t have dramatic errors fastest way to generate linear gradients is to fill a strip with correct values and then to resize it.</p>

<p>Now I&#8217;ll go back to work on my learning project.</p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/11/drawing-gradients-with-pygame/' addthis:title='Drawing Gradients with PyGame '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' rel='bookmark' title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor'>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=394&amp;md5=3cb4c095b4c366584efb33b30c607bf5" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2010/11/drawing-gradients-with-pygame/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=394&amp;md5=3cb4c095b4c366584efb33b30c607bf5" type="text/html" />
	</item>
		<item>
		<title>How to Install MySQL with Fabric</title>
		<link>http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-install-mysql-with-fabric</link>
		<comments>http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/#comments</comments>
		<pubDate>Sat, 22 May 2010 06:51:12 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=372</guid>
		<description><![CDATA[I just want to share a small fabfile snipplet that installs mysql-server package on a Debian machine if it&#8217;s not already installed. Actually it should have been quite straightforward; just issue an apt-get command, right? But during configuration it displays a curses dialog for MySQL root password. This of course blows your automated configuration plans. [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/' addthis:title='How to Install MySQL with Fabric '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>I just want to share a small <a href="http://fabfile.org/">fabfile</a> snipplet that installs <code>mysql-server</code> package on a Debian machine if it&#8217;s not already installed. Actually it should have been quite straightforward; just issue an <code>apt-get</code> command, right? But during configuration it displays a curses dialog for MySQL root password. This of course blows your automated configuration plans. We will seed this value to <code>debconf</code> database to avoid this dialog.</p>

<p>First let&#8217;s have a look at the supporting code:</p>

<p><code><pre style="color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';"><span style="color:#000000; font-weight:bold">from</span> &#95;&#95;future&#95;&#95; <span style="color:#000000; font-weight:bold">import</span> with&#95;statement
<span style="color:#000000; font-weight:bold">from</span> fabric<span style="color:#000000">.</span>api <span style="color:#000000; font-weight:bold">import</span> <span style="color:#000000">*</span>
<span style="color:#000000; font-weight:bold">from</span> fabric<span style="color:#000000">.</span>utils <span style="color:#000000; font-weight:bold">import</span> warn</p>

<p><span style="color:#000000; font-weight:bold">def</span> <span style="color:#010181">apt&#95;get</span><span style="color:#000000">(*</span>packages<span style="color:#000000">):</span>
    <span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'apt-get -y --no-upgrade install %s'</span> <span style="color:#000000">%</span> <span style="color:#ff0000">' '</span><span style="color:#000000">.</span><span style="color:#010181">join</span><span style="color:#000000">(</span>packages<span style="color:#000000">),</span> shell<span style="color:#000000">=</span><span style="color:#000000; font-weight:bold">False</span><span style="color:#000000">)</span>
</pre></code></p>

<p>Our <code>apt_get</code> fabric command issues <code>apt_get install</code> that answers <code>yes</code> to all questions and does not upgrade if the requested package is already installed. Now let&#8217;s take a look at the main command that installs <code>mysql-server</code>:</p>

<p><code><pre style="color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';"><span style="color:#000000; font-weight:bold">def</span> <span style="color:#010181">install&#95;mysql</span><span style="color:#000000">():</span>
    with <span style="color:#010181">settings</span><span style="color:#000000">(</span><span style="color:#010181">hide</span><span style="color:#000000">(</span><span style="color:#ff0000">'warnings'</span><span style="color:#000000">,</span> <span style="color:#ff0000">'stderr'</span><span style="color:#000000">),</span> warn&#95;only<span style="color:#000000">=</span><span style="color:#000000; font-weight:bold">True</span><span style="color:#000000">):</span>
        result <span style="color:#000000">=</span> <span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'dpkg-query --show mysql-server'</span><span style="color:#000000">)</span>
    <span style="color:#000000; font-weight:bold">if</span> result<span style="color:#000000">.</span>failed <span style="color:#000000; font-weight:bold">is False</span><span style="color:#000000">:</span>
        <span style="color:#010181">warn</span><span style="color:#000000">(</span><span style="color:#ff0000">'MySQL is already installed'</span><span style="color:#000000">)</span>
        <span style="color:#000000; font-weight:bold">return</span>
    mysql&#95;password <span style="color:#000000">=</span> <span style="color:#010181">prompt</span><span style="color:#000000">(</span><span style="color:#ff0000">'Please enter MySQL root password:'</span><span style="color:#000000">)</span>
    <span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'echo &quot;mysql-server-5.0 mysql-server/root&#95;password password '</span> \
                              <span style="color:#ff0000">'%s&quot; | debconf-set-selections'</span> <span style="color:#000000">%</span> mysql&#95;password<span style="color:#000000">)</span>
    <span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'echo &quot;mysql-server-5.0 mysql-server/root&#95;password&#95;again password '</span> \
                              <span style="color:#ff0000">'%s&quot; | debconf-set-selections'</span> <span style="color:#000000">%</span> mysql&#95;password<span style="color:#000000">)</span>
    <span style="color:#010181">apt&#95;get</span><span style="color:#000000">(</span><span style="color:#ff0000">'mysql-server'</span><span style="color:#000000">)</span>
</pre></code></p>

<p>First we want to make sure <code>mysql-server</code> is not already installed. For this reason we issue <code>dpkg-query --show mysql-server</code>. Note that if this command fails then <code>mysql-server</code> is not installed and we can proceed otherwise we want to return. We hide the ugly error messages by running our <code>dpkg-query</code> command within a <code>settings</code> context:</p>

<p><code><pre style="color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';">with <span style="color:#010181">settings</span><span style="color:#000000">(</span><span style="color:#010181">hide</span><span style="color:#000000">(</span><span style="color:#ff0000">'warnings'</span><span style="color:#000000">,</span> <span style="color:#ff0000">'stderr'</span><span style="color:#000000">),</span> warn&#95;only<span style="color:#000000">=</span><span style="color:#000000; font-weight:bold">True</span><span style="color:#000000">):</span>
    result <span style="color:#000000">=</span> <span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'dpkg-query --show mysql-server'</span><span style="color:#000000">)</span>
<span style="color:#000000; font-weight:bold">if</span> result<span style="color:#000000">.</span>failed <span style="color:#000000; font-weight:bold">is False</span><span style="color:#000000">:</span>
    <span style="color:#010181">warn</span><span style="color:#000000">(</span><span style="color:#ff0000">'MySQL is already installed'</span><span style="color:#000000">)</span>
    <span style="color:#000000; font-weight:bold">return</span>
</pre></code></p>

<p>The rest of the code is pretty straightforward. We prompt to the user running fabric for the root password and seed its value twice into the <code>debconf</code> database.</p>

<p><code><pre style="color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';"><span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'echo &quot;mysql-server-5.0 mysql-server/root&#95;password password '</span> \
                            <span style="color:#ff0000">'%s&quot; | debconf-set-selections'</span> <span style="color:#000000">%</span> mysql&#95;password<span style="color:#000000">)</span>
<span style="color:#010181">sudo</span><span style="color:#000000">(</span><span style="color:#ff0000">'echo &quot;mysql-server-5.0 mysql-server/root&#95;password&#95;again password '</span> \
                            <span style="color:#ff0000">'%s&quot; | debconf-set-selections'</span> <span style="color:#000000">%</span> mysql&#95;password<span style="color:#000000">)</span>
<span style="color:#010181">apt&#95;get</span><span style="color:#000000">(</span><span style="color:#ff0000">'mysql-server'</span><span style="color:#000000">)</span>
</pre></code></p>

<p>Finally, having finished our little dance, we install <code>mysql-server</code>. I hope this helps some automated deployment believer out there.</p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/' addthis:title='How to Install MySQL with Fabric '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2010/11/drawing-gradients-with-pygame/' rel='bookmark' title='Drawing Gradients with PyGame'>Drawing Gradients with PyGame</a></li>
<li><a href='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' rel='bookmark' title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor'>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=372&amp;md5=dae3a168508e59a8355607a01eba67a1" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=372&amp;md5=dae3a168508e59a8355607a01eba67a1" type="text/html" />
	</item>
		<item>
		<title>My Idea Of The Django Blogging App™</title>
		<link>http://www.muhuk.com/2010/04/my-idea-of-the-django-blogging-app%e2%84%a2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-idea-of-the-django-blogging-app%25e2%2584%25a2</link>
		<comments>http://www.muhuk.com/2010/04/my-idea-of-the-django-blogging-app%e2%84%a2/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 09:36:48 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[blogs]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[reusable]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=370</guid>
		<description><![CDATA[I am not going to talk about yet another Django-based blogging engine in this post. There are a number of blogging apps which try to be like turn-key solutions, like a WordPress blog. I have skimmed through the code of many such apps, but haven&#8217;t used one yet. Some of them are really high quality [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/04/my-idea-of-the-django-blogging-app%e2%84%a2/' addthis:title='My Idea Of The Django Blogging App™ '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>I am not going to talk about yet another Django-based blogging engine in this post. There are a number of blogging apps which try to be like turn-key solutions, like a WordPress blog. I have skimmed through the code of many such apps, but haven&#8217;t used one yet. Some of them are really high quality apps. What I have in mind is somewhat different though. I would like an app that would allow me to build a blog that satisfies my projects specific requirements.</p>

<p>Let me reiterate the last sentence. Having a Django-based blog just because Django is fashinable is a little dumb in my opinion. If Django-based X blogging engine suits you better than anything else, use it. Why not? But my personal choice of blogging engine is WordPress<sup>1</sup>. The value of a Django blogging app, for me, is in <em>adding</em> a blog to a Django project. And different projects might have different requirements. So my idea of a Django blogging app is one that is highly configurable and highly extendable.</p>

<p>On the other hand I don&#8217;t need the convenience of clicking a checkbox on a polished UI. I can write a function. Or I don&#8217;t necessarily need it to, say, provide a navigation menu. There are apps that do that. Even if there wasn&#8217;t it shouldn&#8217;t be the blog app&#8217;s job. So I am not looking for an instant-blog. I have a Django app in my mind, nothing more.</p>

<h3>What Should Be Left Out</h3>

<p>Basically any feature that can be provided by another <a href="http://www.muhuk.com/tag/reusable/">reusable app</a> should be left out. Why should we re-implement something that is already done&#8230; and reviewed by others&#8230; and tested. Of course this doesn&#8217;t necessarily mean providing no convenience functions.</p>

<ul>
<li>No admin. Because we already have <a href="http://docs.djangoproject.com/en/dev/ref/contrib/admin/">one</a>.</li>
<li>No theming. For the love of Flying Spaghetti Monster, you don&#8217;t need any <em>theming</em> other than what <code>django.template</code> offers. Pre-built themes are for turn-key solutions.</li>
<li>No comments or contact forms. (See <a href="http://docs.djangoproject.com/en/dev/ref/contrib/comments/"><code>django.contrib.comments</code></a> and <a href="http://bitbucket.org/ubernostrum/django-contact-form/"><code>django-contact-form</code></a>)</li>
<li>No <em>official</em> markup format (or formats). This can be handled in the templates without difficulty. But, maybe, pluggable content filters is a good idea. I haven&#8217;t made up my mind on this one entirely. It won&#8217;t use any markup format by default, that is for sure.</li>
</ul>

<h3>What Should Be Included</h3>

<p>Remember, every project has a different set of needed features for its blog. Some need catagories, some need tags and some others need both. But it would end up as a disaster if we implemented each one of those features into <a href="http://www.muhuk.com/2010/01/developing-reusable-django-apps/">a single app</a>. Instead I think it should consist of many small apps that work together. But I wouldn&#8217;t want to end up having huge spaghetti of apps that all depend on one another, like <a href="http://pinaxproject.com/">Pinax</a> does. A minimal amount of core apps<sup>2</sup> and then everything else should be optional. By optional I mean you don&#8217;t have to install packages you won&#8217;t need.</p>

<p>I think the components (apps) should be activated via adding to <code>INSTALLED_APPS</code> and configured with settings. I can&#8217;t think of any parameter that needs to be changed dynamically, so why not use the established way of doing configuration in Django.</p>

<p>Two must have features for such a blogging app are previews and scheduled publishing. It is possible that you sometimes write a post quickly and publish it immediately. But I suppose nobody will say they don&#8217;t care about these two features.</p>

<p>Built-in feeds and sitemaps are also nice to have.</p>

<p>Multiple instances of this blogging app running on the same project? À la <code>admin</code>. I can&#8217;t make my mind on this one. Sure it would be a nice feature. But it could complicate the code. Peehaps too much for a not so common case.</p>

<p>What do you think about the general idea? Are there any other <em>must-have</em> features? Would you be willing to learn a new app when you are already comfortable with another blogging app?</p>

<hr />

<p><strong>1:</strong> Even though it&#8217;s written in the abomination called PHP. But since there are plugins for everything I don&#8217;t have to touch the code.</p>

<p><strong>2:</strong> One sounds like a good number, if possible.</p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/04/my-idea-of-the-django-blogging-app%e2%84%a2/' addthis:title='My Idea Of The Django Blogging App™ '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' rel='bookmark' title='Working with files in Django &#8211; Part 3'>Working with files in Django &#8211; Part 3</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=370&amp;md5=83329d2e3f16f84bd0e5b86894bd6017" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2010/04/my-idea-of-the-django-blogging-app%e2%84%a2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=370&amp;md5=83329d2e3f16f84bd0e5b86894bd6017" type="text/html" />
	</item>
		<item>
		<title>What&#8217;s New in django-formfieldset 1.1</title>
		<link>http://www.muhuk.com/2010/03/whats-new-in-django-formfieldset-1-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=whats-new-in-django-formfieldset-1-1</link>
		<comments>http://www.muhuk.com/2010/03/whats-new-in-django-formfieldset-1-1/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 20:40:04 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[django-formfieldset]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[share]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=352</guid>
		<description><![CDATA[I have just released 1.1 version of django-formfieldset. I has been almost a year since version 1.0. Here is a summary of changes for this version: New Example Project There is a new and improved example project. It is designed to be some sort of documentation at the same time. When you run the example [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/03/whats-new-in-django-formfieldset-1-1/' addthis:title='What&#8217;s New in django-formfieldset 1.1 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>I have just released 1.1 version of <a href="http://github.com/muhuk/django-formfieldset/">django-formfieldset</a>. I has been almost a year since <a href="http://www.muhuk.com/2009/05/django-formfieldset/">version 1.0</a>. Here is a summary of changes for this version:</p>

<h3>New Example Project</h3>

<p>There is a new and improved example project. It is designed to be some sort of documentation at the same time. When you run the example project and visit different pages you will see, for each examle, Python code, template code, text of rendered result and finally the result embedded.</p>

<p>If you have <a href="http://pygments.org/">Pygments</a> installed all the code will be nicely highlighted.</p>

<h3>Fieldset &amp; FieldsetMixin Improvements</h3>

<p>Fieldset definitions are validated now. An exception will be raised if all of your fields are not included exactly once.</p>

<p>Template strings that are used by <code>as_table</code>, <code>as_p</code> and <code>as_ul</code> methods are now class attributes. You can simply override them instead of writing your own <code>as_*</code> method.</p>

<p><code>FieldsetMixin</code> provides a <code>fieldset_dict</code> attribute. This dictionary has <strong>slugified</strong> fieldset names as keys and <code>Fieldset</code> instances as values. Your fieldset declarations can still be accessed from <code>fielsets</code> attribute.</p>

<h3>Rendering Improvements</h3>

<p>There are two rendering related improvements: individual fieldset rendering and <code>renderform</code> template filter.</p>

<p><code>Fieldset</code> objects have <code>as_table</code>, <code>as_p</code>, <code>as_ul</code> methods just like forms. Errors from hidden fields are handled correctly, but you still need to call <code>non_field_errors()</code> to get the top level errors. Also it is template author&#8217;s responsibility to make sure all the fieldsets are rendered.</p>

<p>If <code>as_*</code> methods are not enough for you, with <code>renderform</code> filter you can render your forms or <code>Fieldset</code>s through a custom template. It works like this:</p>

<pre><code>{{ form.fieldset_dict.mytitlerenderform:"myapp/mytitle_fieldset.html" }}
</code></pre>

<p>If you call it without an argument <code>formfieldset/form.html</code> template will be used.</p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/03/whats-new-in-django-formfieldset-1-1/' addthis:title='What&#8217;s New in django-formfieldset 1.1 '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' rel='bookmark' title='Working with files in Django &#8211; Part 3'>Working with files in Django &#8211; Part 3</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=352&amp;md5=d54ca8e82c4079f5e11ff2997c7e3e44" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2010/03/whats-new-in-django-formfieldset-1-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=352&amp;md5=d54ca8e82c4079f5e11ff2997c7e3e44" type="text/html" />
	</item>
		<item>
		<title>Developing Reusable Django Apps: Signals</title>
		<link>http://www.muhuk.com/2010/03/developing-reusable-django-apps-signals/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=developing-reusable-django-apps-signals</link>
		<comments>http://www.muhuk.com/2010/03/developing-reusable-django-apps-signals/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 08:49:17 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[reusable]]></category>
		<category><![CDATA[signals]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=346</guid>
		<description><![CDATA[I wrote &#8220;signals provide a great way to propagate the events generated from your app&#8221; earlier. I think reusable apps should avoid hardcoding any kind of event handling and send signals instead. App consumers might prefer an email over an on-screen notification. They may even choose to ignore the event silently. A reusable app should [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/03/developing-reusable-django-apps-signals/' addthis:title='Developing Reusable Django Apps: Signals '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>I wrote &#8220;<a href="http://www.muhuk.com/2010/01/developing-reusable-django-apps/"><em>signals provide a great way to propagate the events generated from your app</em></a>&#8221; earlier. I think reusable apps should avoid hardcoding any kind of event handling and <a href="http://docs.djangoproject.com/en/dev/topics/signals/">send signals</a> instead. App consumers might prefer an email over an on-screen notification. They may even choose to ignore the event silently. A reusable app should give this choice to the consumer.</p>

<p>Taking advantage of signals doesn&#8217;t necessarily mean providing no sane defaults. You can send signals <strong>and</strong> provide default event handling. Here is a couple of ideas how this can be done:</p>

<ul>
<li>Your app can <a href="http://stackoverflow.com/questions/2209159/disconnect-signals-for-models-and-reconnect-in-django/2209804#2209804">check if there are any listeners</a> and connect the default handlers if there is none.</li>
<li>You can ship an auxiliary app that connects default handlers when added to <code>INSTALLED_APPS</code>.</li>
</ul>

<p>I personally prefer the second approach since it&#8217;s simpler and more explicit. I&#8217;m sure there are other ways to implement default handlers for signals.</p>

<h3>Dispatch_uid</h3>

<p>Don&#8217;t forget to assign a unique <code>dispatch_uid</code> for each <code>connect()</code> call. Otherwise your handler can get <a href="http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave">connected twice</a>. I would also suggest you to use both module path <strong>and</strong> your handler function&#8217;s name in your <code>dispatch_uid</code>:</p>

<pre><code>"%s.%s" % (os.path.splitext(__file__)[0].replace(os.sep, '.')[1:],
           handler_name)
</code></pre>

<p>Now I should take my own advice and replace hardcoded <code>User.message_set.create()</code>s with signals in <a href="http://github.com/muhuk/django-simple-friends">django-simple-friends</a>.</p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/03/developing-reusable-django-apps-signals/' addthis:title='Developing Reusable Django Apps: Signals '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-3/' rel='bookmark' title='Working with files in Django &#8211; Part 3'>Working with files in Django &#8211; Part 3</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=346&amp;md5=aa54d067afb2b49cafc62fa354d6b44b" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2010/03/developing-reusable-django-apps-signals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=346&amp;md5=aa54d067afb2b49cafc62fa354d6b44b" type="text/html" />
	</item>
		<item>
		<title>Web Site Performance Optimizations</title>
		<link>http://www.muhuk.com/2010/02/web-site-performance-optimizations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=web-site-performance-optimizations</link>
		<comments>http://www.muhuk.com/2010/02/web-site-performance-optimizations/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 12:01:43 +0000</pubDate>
		<dc:creator>Atamert Ölçgen</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.muhuk.com/?p=342</guid>
		<description><![CDATA[Recently I have done some optimizations to make telvee a little faster using django_compressor and making sprites for background images. Good news is substantial changes to development environment and the design wasn&#8217;t required. I&#8217;ll get into details below. But first I&#8217;d like to write about the theory a little bit. I follow (and read with [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/02/web-site-performance-optimizations/' addthis:title='Web Site Performance Optimizations '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<p>Recently I have done some optimizations to make <a href="http://www.telvee.com">telvee</a> a little faster using <a href="http://github.com/muhuk/django_compressor">django_compressor</a> and making sprites for background images. Good news is substantial changes to development environment and the design wasn&#8217;t required. I&#8217;ll get into details below. But first I&#8217;d like to write about the theory a little bit.</p>

<p>I follow (and read with great interest) Steve Souders&#8217;s blog <a href="http://www.stevesouders.com/blog/">High Performance Web Sites</a>. I must admit I was sceptical about it at first; spriting images, individual different loading behaviours of browsers&#8230; I thought they were <a href="http://en.wikipedia.org/wiki/Program_optimization">premature optimization</a>s. But I realized I was wrong as I continued to read. Steve Souders is an expert on high performance web sites and what he preaches are realistic techniques, backed by test results most of the time. If you are not following, I suggest you add it to your RSS reader.</p>

<h3>Optimization Techniques</h3>

<p>We can explore the techniques in two main categories:</p>

<ol>
<li>Techniques to reduce the data to be transferred.

<ul>
<li><strong>Minifying</strong>: Minification is removing comments and unneeded whitespace in CSS and JavaScript files. Compilers like <a href="developer.yahoo.com/yui/compressor/">YUI Compressor</a> and <a href="code.google.com/closure/">Closure</a> modifies JavaScript code to compress even further, without any changes to the functionality.</li>
<li><strong>Gzipping</strong>: Web browsers accept <a href="http://en.wikipedia.org/wiki/Gzip#Other_uses">gzip</a> encoded content for a long time. I have just compressed a 13 KB text file down to 4 KB. A two thirds compression ratio is not bad at all.</li>
</ul></li>
<li>Techniques to reduce the number of HTTP requests.

<ul>
<li><strong>Combining</strong>: CSS and JavaScript files can be combined together into a single file and therefore a single HTTP request. Gzip may be more efficient on these files. In a similar way background images can be merged into a <a href="http://en.wikipedia.org/wiki/Sprite_%28computer_graphics%29#Application">sprite</a> and then reconstructed again using their coordinates on that sprite.</li>
<li><strong>Data URI&#8217;s</strong>: Images (or other file types) can be embedded into CSS (or JavaScript or HTML) using <a href="http://en.wikipedia.org/wiki/Data_URI_scheme"><code>data: URI</code>&#8216;s</a>. Extra HTTP requests for those resources can be avoided this way.</li>
</ul></li>
</ol>

<p>You might think <em>it&#8217;s fine to perform all these optimizations, but what happens when I want to make some changes to my combined, minified JavaScript file?</em> Instead of applying these techniques blindly, it&#8217;s best to follow a sensible plan for implementing these optimizations:</p>

<ul>
<li>First of all <em>everything that can be automated should be automated</em>. Regarding the example above script files should stay uncombined and uncompressed in the development environment and optimizations should be applied when the application is published. Taking it a step further we can have the application detect changes in those files and update optimized versions automatically. (django&#95;compressor works this way)</li>
<li>I was worried that spriting would complicate managing the design. But I have seen, on the contrary; if images each sprite contain are choosen carefully it makes the process easier. Start combining images that belong to the same design element. Avoid complex arrangements, stick with horizontal or vertical stacking as much as possible. Don&#8217;t forget to leave transparent spaces between items and sprite border. Try to combine images that are loaded on the same page, avoid loading a sprite for only half of it&#8217;s elements. Don&#8217;t force yourself to combine all images, if you follow the guidelines I have mentione they won&#8217;t.</li>
<li>When performing optimizations don&#8217;t forget to use easily available tools. You can use <a href="http://developer.yahoo.com/yslow/">YSlow</a> for general analysis, <a href="http://spriteme.org/">SpriteMe</a> for image combining tips, <a href="http://compressorrater.thruhere.net/">CompressorRater</a> to compare different compilers&#8217; performance on your scripts. I would like to note that Steve Souders is the developer of first two.</li>
</ul>

<h3>Telvee Results</h3>

<p>I didn&#8217;t think about performance at all when I started developing <a href="http://www.telvee.com">telvee</a>. Too many CSS files and too many images were being loaded. Here is what it looked like before optimizations:</p>

<table>
  <tr><th>&nbsp;</th><th># of requests</th><th>load (KB)</th></tr>
  <tr><th>Homepage</th><td>25</td><td>~85</td></tr>
  <tr><th>Cup Detail</th><td>48</td><td>~80</td></tr>
</table>

<p>Then I have installed and configured <a href="http://github.com/muhuk/django_compressor">django_compressor</a>. I used YUI Compressor for both JavaScript and CSS. I have created sprites and modified CSS files manually<sup>1</sup>. Then I deployed these changes and measured again:</p>

<table>
  <tr><th>&nbsp;</th><th># of requests</th><th>load (KB)</th></tr>
  <tr><th>Homepage</th><td>12</td><td>~70 (~160)</td></tr>
  <tr><th>Cup Detail</th><td>14</td><td>~64</td></tr>
</table>

<p>In the load column of Homepage, the number in parens is the actual load. But the design of homepage is changed with this upgrade and a new 90 KB image is being loaded now. So I have accepted 70 KB in my calculations. The result of optimizations are as follows:</p>

<table>
  <tr><th>&nbsp;</th><th># of requests</th><th>load (KB)</th></tr>
  <tr><th>Homepage</th><td>52%</td><td>17%</td></tr>
  <tr><th>Cup Detail</th><td>70%</td><td>19%</td></tr>
</table>

<h3>Django&#95;compressor and Data URI&#8217;s</h3>

<p>Django&#95;compressor, developed by Christian Metts, helps you to apply optmizations I have mentioned above easily to your <a href="http://www.djangoproject.com/">Django</a> projects. You can see my fork <a href="http://github.com/muhuk/django_compressor">here</a> where I have merged some other branches and added a little bit of code myself.</p>

<p>Using <code>compressor.filters.datauri.CssDataUriFilter</code> in <code>data-uri</code> branch of this repository, you can embed linked files within your CSS files. It will only embed files less than or equal to 1024 Bytes (1 KB) by default. You can change this limit by setting <code>COMPRESS_DATA_URI_MIN_SIZE</code> in your <code>settings.py</code>.</p>

<p>There are a couple of things to pay attention when you convert your references to <code>data: URI</code>s. Firstly file contents are <code>base64</code> encoded which means approximately one third increase in size. It&#8217;s up to you to balance between increased bandwidth and reduced request counts<sup>2</sup>. Another thing to watch for is multiple references to the same file will end up embedding the same data many times. The solution to this problem is to reduce all references to one<sup>3</sup> but this might break your CSS arrangement strategy.</p>

<p>Please test django&#95;compressor&#8217;s <code>data: URI</code> support and tell me what you think. If you haven&#8217;t applied optimizations I mentioned above, you should. Thanks to django&#95;compressor they are quite easy to implement on Django projects.</p>

<hr />

<p><strong>1</strong>: I would like to add automatic sprite building/linking support to django&#95;compressor sometime.</p>

<p><strong>2</strong>: With Today&#8217;s modern connections 1~2 KB increase is a good price for 1 less HTTP request..</p>

<p><strong>3</strong>: <a href="http://meiert.com/en/blog/20090401/why-css-needs-no-variables/">http://meiert.com/en/blog/20090401/why-css-needs-no-variables/</a></p>
<div><a class="addthis_button" href="http://www.muhuk.com//addthis.com/bookmark.php?v=250" addthis:url='http://www.muhuk.com/2010/02/web-site-performance-optimizations/' addthis:title='Web Site Performance Optimizations '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div><p>Related posts:<ol>
<li><a href='http://www.muhuk.com/2011/06/pycon-apac-optimizing-media-performance-with-django_compressor/' rel='bookmark' title='My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor'>My PyCon APAC 2011 Presentation: Optimizing Media Performance with django_compressor</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django/' rel='bookmark' title='Working with files in Django &#8211; Part 1'>Working with files in Django &#8211; Part 1</a></li>
<li><a href='http://www.muhuk.com/2011/11/working-with-files-in-django-part-2/' rel='bookmark' title='Working with files in Django &#8211; Part 2'>Working with files in Django &#8211; Part 2</a></li>
</ol></p> <p><a href="http://www.muhuk.com/?flattrss_redirect&amp;id=342&amp;md5=e915f187c1eb8b5047a9c0f4aaaa8b6a" title="Flattr" target="_blank"><img src="http://www.muhuk.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.muhuk.com/2010/02/web-site-performance-optimizations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://www.muhuk.com/?flattrss_redirect&amp;id=342&amp;md5=e915f187c1eb8b5047a9c0f4aaaa8b6a" type="text/html" />
	</item>
	</channel>
</rss>

