Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
How to roast a chicken
Look, people, cooking isn’t hard. Some recipes are hard, but really most of the best, classic dishes are as easy as pie [1]. Take a nice roast chicken. It’s showy – whole birds look fantastic – and just about the easiest thing in the world. With a tiny bit of attention to detail you can crank out a delicious meal that’ll knock people’s socks off. If you want to really sound impressive, tell people that the recipe is from Thomas Keller – chef-owner of The French Laundry, one of the best restaurants in the country [2]. -
SEOmoz meetup in Sofia, Bulgaria
First of all I want to thank to Rand Fishkin from SEOmoz and the Webit team for organizing this meetup. For a long time in the web world there was a feud between the developers and the SEO guys. Both groups claiming that their work is more important, more sophisticated and with bigger value to [...] -
Open "Office Hours"
We've been wanting to try this for awhile, but have been too busy to actually try it out until now. Jacob Kaplan-Moss and I will be holding open "office hours" this Friday November 5th between 1-3 PM CDT in IRC. Come join us in #revsys on freenode and pick our brains. Or just come to listen and learn. The concept is pretty simple, Jacob and I (and likely many other knowledgeable Djangonauts) will be in the channel and attempt to answer your questions related to: Django/Python Deployment Scaling/Performance PostgreSQL Anything else we happen to know... We're going to log the discussion and will provide a transcript online afterwards. Update: The transcript is now available. -
Django gotcha: concrete inheritance
Since 1.0, Django’s supported model inheritance. It’s a neat feature, and can go a long way towards increasing flexibility in your modeling options. However, model inheritance also offers a really excellent opportunity to shoot yourself in the foot: concrete (multi-table) inheritance. If you’re using concrete inheritance, Django creates implicit joins back to the parent table on nearly every query. This can completely devastate your database’s performance. To refresh, if you’ve got models like: -
django-FUNserver
Step 1: pip install django-funserver Step 2: Add “funserver” to your INSTALLED_APPS. Step 3: Run manage.py funserver. For best results, don’t do this on a real server. Code is here, for those interested. Read full entry -
Search on djangosnippets.org
Users of djangosnippets.org may have noticed the addition of a few search-related features over the past several months. I'd like to highlight some of the additions that have been made and show how you can implement similar functionality on your sites. All of djangosnippet's search leans on Apache Solr, a powerful search engine built on top of Apache Lucene. Haystack is the search solution for Django apps - it provides a querying interface similar to Django's ORM, handles indexing your models for you, and supports advanced features like "more-like-this" and faceting. Getting set up (angle brackets, anyone?) I've actually written another post on setting up multi-core Solr on Ubuntu 10.04. I got a bit of flak for using tomcat6 as the server - you can definitely go with jetty instead. Jetty is bundled with Solr, check out the examples/README.txt to get started quickly. You might find the following links useful: Installing Solr Apache Solr + Jetty Apache Solr + Tomcat6 When setting up search with haystack, there are two important configuration files to be aware of: schema.xml solrconfig.xml schema.xml The Solr schema is only superficially analagous to a database schema (if your database was just one big freaking table). It … -
django-FUNserver
Step 1: pip install django-funserver Step 2: Add “funserver” to your INSTALLED_APPS. Step 3: Run manage.py funserver. For best results, don’t do this on a real server. Code is here, for those interested. Read full entry and comments -
What's your favorite Django app?
On Twitter, I asked, “what’s your favorite third-party Django app?” Eight hours later, I’ve got about 50 replies. I meant the question to be fairly open-ended – I deliberately didn’t clarify what I meant by “favorite” – and I’m not that popular, so this is by no means an accurate sample of the Django community. Still, the answers are a bit interesting, so let’s take a look: The winners The favorite was… (drumroll please)… South. -
Using web-based image editors with Django apps
Intergrating FotoFlexer, Picnik and Pixlr web based image editors with Django applications -
Python: Virtualenv + pip
"In the Java world there was always a problem with dependencies. All the jars we had to mange by hand – quite awful. Thankfully there is a Maven project which helps us in requirements management. But what about Python? Is there any way to handle necessary libraries? Of course, there is! It is a tandem of virtualenv and pip." by Marcin Swierczynski -
Global Django Permissions
Django has a great solution for web site permissions, it allows the developer to decide how a user can interact with an application based on permissions against models (i.e. database tables). By default a model comes with three permissions, add, change and delete. If these aren’t enough then you can create as many custom model [...] -
Django-qsstats, parce qu’en vrai,on adore tous faire des stats.
Ce mois-ci, j'aurais pu écrire plusieurs django-app du mois. Si j'avais eu le temps. Mais bon, le jour où j'aurais le temps, ça se saura. Du coup, alors que l'horloge tourne et qu'il ne me reste plus qu'un jour et demi pour écrire ma django app du mois et mon polargeek, j'ai décidé d'écrire ... -
Gràcies a tots per venir al creant bits: eines
Actualització: Pujats els documents al dropbox Presentació d'eines Presentació Git Una vegada més, i ja van quatre el creantbits ens ha servit per carregar piles, per trobar-nos amb amics que feia temps que no veiem. Cares conegudes d'altres trobades (des d'aquí moltes gràcies per el detall de les galletes) i un quòrum impressionant. Se nota que en Pau té tirada :) Feia estona que volíem fer una altra trobada d'aquestes. Personalment crec que és molt enriquidora pel que representa d'important per nosaltres veure que hi ha molta més gent que s'interessa pel mateix tipus de coses que nosaltres. Com ja he dit altres vegades això me fa tornar la fe amb la professió. M'hagués agradat poder fer streaming de vídeo, l'hem intentant, però ens ha fallat la connexió. Ja sé que estam a un Parc tecnològic, però ja sabeu com van aquestes coses. A APSL necessitàrem prop de tres mesos en tenir una ADSL i és sols de les normaletes (i cares), res de connexions de 50 Mb que hi ha pels pobles. A veure si la propera vegada hi ha més sort! Com a telonero de Pau he presentat un grapat d'eines que trob d'allò més interessants per fer … -
uWSGI and Django Secure Requests
A colleague and I ran into a frustrating situation this evening when transitioning a site from Apache and mod_wsgi to uWSGI. Django's request.is_secure() wasn't working correctly. After much Googling and shouting at the SSH console, we finally discovered the UWSGI_SCHEME uWSGI parameter. To fix the issue, we edited /etc/nginx/uwsgi_params (which originally comes from nginx/uwsgi_params in the uWSGI tarball) and added an additional param at the bottom: uwsgi_param UWSGI_SCHEME $scheme; This prompts uWSGI to set wsgi.url_scheme to the appropriate value, which Django then detects in the wsgi handler. I'd really love to see this in the documentation on the uWSGI site, or (even better) included by default in the uwsgi_params in the tarball. In the meantime, though, it's a relatively quick and easy fix. Enjoy! -
"Web Scale"
Christophe Pettus: What does [“web scale”] mean? It clearly means something along the lines of, “Can handle lots of transactions per unit time,” but how many? I mean, WordPress with WP-SuperCache is “web scale” if all that is meant is, “Can be used to implement a high volume site,” but I assume those who are touting something as “web scale” are aiming higher than that. Anyone care to offer a quantitative definition of this term? -
In Django, how much faster is it to aggregate?
Being able to do aggregate functions with Django's QuerySet API is really useful. Not because it's difficult to write your own loop but because the summation is then done inside the SQL database. I had this piece of code: t = Decimal('0') for each in some_queryset: t += each.cost Which can be rewritten like this instead: t = qs.aggregate(Sum('cost'))['cost__sum'] For my 6,000+ records in the database the first one takes about 0.7 seconds. The aggregate takes 0.02 seconds. Blimey! That's over 30 fold difference in speed for practically the same thing. Granted, when doing the loop you can do some other stuff such as counting or additional function calls but that difference is quite significant. In my current application those 0.7 seconds isn't really a problem but it quickly becomes when it has to be done over and over for multiple sets. -
In Django, how much faster is it to aggregate?
Being able to do aggregate functions with Django's QuerySet API is really useful. Not because it's difficult to write your own loop but because the summation is then done inside the SQL database. I had this piece of code: t = Decimal('0') for each in some_queryset: t += each.cost Which can be rewritten like this instead: t = qs.aggregate(Sum('cost'))['cost__sum'] For my 6,000+ records in the database the first one takes about 0.7 seconds. The aggregate takes 0.02 seconds. Blimey! That's over 30 fold difference in speed for practically the same thing. Granted, when doing the loop you can do some other stuff such as counting or additional function calls but that difference is quite significant. In my current application those 0.7 seconds isn't really a problem but it quickly becomes when it has to be done over and over for multiple sets. -
In Django, how much faster is it to aggregate?
Being able to do aggregate functions with Django's QuerySet API is really useful. Not because it's difficult to write your own loop but because the summation is then done inside the SQL database. I had this piece of code: t = Decimal('0') for each in some_queryset: t += each.cost Which can be rewritten like this instead: t = qs.aggregate(Sum('cost'))['cost__sum'] For my 6,000+ records in the database the first one takes about 0.7 seconds. The aggregate takes 0.02 seconds. Blimey! That's over 30 fold difference in speed for practically the same thing. Granted, when doing the loop you can do some other stuff such as counting or additional function calls but that difference is quite significant. In my current application those 0.7 seconds isn't really a problem but it quickly becomes when it has to be done over and over for multiple sets. -
In Django, how much faster is it to aggregate?
Being able to do aggregate functions with Django's QuerySet API is really useful. Not because it's difficult to write your own loop but because the summation is then done inside the SQL database. I had this piece of code: t = Decimal('0') for each in some_queryset: t += each.cost Which can be rewritten like this instead: t = qs.aggregate(Sum('cost'))['cost__sum'] For my 6,000+ records in the database the first one takes about 0.7 seconds. The aggregate takes 0.02 seconds. Blimey! That's over 30 fold difference in speed for practically the same thing. Granted, when doing the loop you can do some other stuff such as counting or additional function calls but that difference is quite significant. In my current application those 0.7 seconds isn't really a problem but it quickly becomes when it has to be done over and over for multiple sets. -
Diapositivas del taller Django en Nicaragua
Estas son las diapositivas del taller sobre Django que impartió ayer Adolfo Fitoria en Nicaragua. -
Taller Django!
Hoy se llevó a cabo un el primer taller sobre Django en Nicaragua, la cita se dió en SIMAS y estuve compartiendo con los asistentes sobre como hacer una pequeña aplicación de blog en este framework y la experiencia de SIMAS. … Continue reading → -
Taller Django!
Hoy se llevó a cabo un el primer taller sobre Django en Nicaragua, la cita se dió en SIMAS y estuve compartiendo con los asistentes sobre como hacer una pequeña aplicación de blog en este framework y la experiencia de SIMAS. Acá les dejo la presentación que utilicé: Django View more presentations from Adolfo Fitoria. Hay algunas fotos haciendo click acá -
Bleach, HTML sanitizer and auto-linker
Bleach, HTML sanitizer and auto-linker. HTML sanitisation is notoriously difficult to do correctly, but Bleach (a Python library) looks like an excellent effort. It uses the html5lib parsing library to deal with potentially malformed HTML, uses a whitelist rather than a blacklist and has a neat feature for auto-linking URLs that is aware of the DOM (so it won’t try to auto-link a URL that is already wrapped in a link element). It was written by the Mozilla team for addons.mozilla.org and support.mozilla.org so it should be production ready. -
Django Apps rock
There's been some chat on mailing lists and conferences about the reusability of apps and about how reusable apps suck. So here's in defence of plain old normal non-reusable Django apps. The ones that probably power most of your current awesome Django sites. They rock. Easy to write and build out a site with. Django apps deserve credit for being so rapid to develop and having a very small set of boilerplate and required code (just a models). So before people come up with schemes for making apps reusable, please remember, we've got a great solution for building apps now. Let's not ruin the speed and simplicity of Django app whilst in pursuit of improved reuse. -
Simple MySQL Backup @ Github
A while ago I wrote about a little script I created, for simple backups of MySQL databases and emailing the backups. I found some time to continue on the project and moved it to Github. You can find it as well as documentation there! Simple MySQL Backup @ Github