Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Content types and Django CMS
The new ENB website One of our latest projects to go live is a new website for the English National Ballet. Part of a major rebrand, we completely replaced their old PHP site with a new content-managed site powered by Django CMS. Django CMS is very flexible, largely due to its minimalistic approach. It provides no page templates out of the box, so you can construct your HTML from the ground up. This is great if you want to make a CMS with a really strong design, because there is very little interference from the framework. However, its minimalistic approach also means that you sometimes have to write extra code to tie all the content together. A good example of this is content types. In Django CMS, there is only one content type: Page. It has certain fields associated with it e.g. title, slug, published. Any other information that appears on a page comes courtesy of plugins. The default Django CMS plugins give you everything you need to add arbitrary text, images and video to a page. But what if you want more fields for your page? Let’s say, for example, you are representing a ballet production and you want … -
Djangorecipe updated for the upcoming buildout 2.0
zc.buildout 2.0 is almost finished (the 2.0 beta 1 came out last week). It is mostly a simplified 1.4.4 zc.buildout that is better maintainable. Simplifications include only supporting distribute instead of also setuptools. And not supporting multiple python versions within one buildout: the one you run buildout with is the one that gets used. And it loses the 1.5/1.6/1.7 complexity of selective isolation from system packages. It also gains some stuff like better defaults. And my patch :-), so it supports distutils-style scripts, too. Handy for installing pyflakes and docutils. And, as I discovered a week ago, you can also let it install all scripts of all required packages with the dependent-scripts = true setting. Anyhow, time to update djangorecipe, as there was a small change in the way buildout 2.0 calls a recipe. Not many recipes will be bitten by it: you don't get passed the python executable anymore. This is only useful when you want to use a different python from the one you run your buildout with. So... I could simplify the code, too, by throwing out support for different python versions :-) Good python 3 news! The upcoming django 1.5 (at release candidate status now) works … -
Translating sentences with substitutions
The problem Many programs build up sentences using bits - often a template into which different things might be substituted. However, the things you substitute into a sentence can change the sentence, and vice-versa, in ways that are not anticipated by the programmer. For example, plurals. In English, you might try code like this: if n == 1: return "I have 1 pig" else: return "I have %s pigs" % n Localising these strings gives problems, because the rules for how to create plural forms is different in every language. This specific problem is generally considered 'solved' by the use of gettext, but many more exist. For example, we have another problem as soon as we start substituting nouns: "Delete selected %s?" % object_name Various attributes about the noun could affect the sentence. In French, the adjective "selected" needs to agree in gender with the noun being substituted in. So you cannot lookup the translations for "Delete selected %s" and for object_name separately. (This is a real example picked from Django source code). Further, depending on how the sentence uses the noun, the form of the noun might need to change. For example, the noun might appear in the accusative … -
Beginner's Guide to PyCon 2013 Part II
This is Part II in a series of blog posts about PyCon US 2013. The goal is to provide a handy reference guide for first time attendees of the world's largest Python conference. Part I was mostly about tutorials, this post will be about registration and the first day of talks. Registration If you haven't done so yet, please register now. Last year PyCon sold out way in advance, and hundreds missed the event. Which is a shame, because the conference is awesome! Keep in mind that the money you spend on registration will go towards a very good thing. You see, after the costs for running PyCon are subtracted, the rest will go to the non-profit Python Software Foundation (PSF). In addition to supporting the Python language itself, the PSF provides financial aid and grants for aspiring developers around the world. Which means the money you spend registering for PyCon will literally change people's lives. This isn't an idle exaggeration, this outreach has made a difference for you, me, and arguably the world. I would love to say more, but that's an article for another day... Alright, on to the talks! Talk Attendance Guidelines At PyCon, talks are either … -
Beginner's Guide to PyCon 2013 Part II
This is Part II in a series of blog posts about PyCon US 2013. The goal is to provide a handy reference guide for first time attendees of the world's largest Python conference. Part I was mostly about tutorials, this post will be about registration and the first day of talks. Registration If you haven't done so yet, please register now. Last year PyCon sold out way in advance, and hundreds missed the event. Which is a shame, because the conference is awesome! Keep in mind that the money you spend on registration will go towards a very good thing. You see, after the costs for running PyCon are subtracted, the rest will go to the non-profit Python Software Foundation (PSF). In addition to supporting the Python language itself, the PSF provides financial aid and grants for aspiring developers around the world. Which means the money you spend registering for PyCon will literally change people's lives. This isn't an idle exaggeration, this outreach has made a difference for you, me, and arguably the world. I would love to say more, but that's an article for another day... Alright, on to the talks! Talk Attendance Guidelines At PyCon, talks are either … -
Crafting your Conference Talk Proposal
With the voting period over for DjangoCon Europe talk proposals I wanted to take a couple of minutes and go over what I think makes a good conference talk proposal and a couple of things that you shouldn’t do. Keep it Informative A lot of people try to be funny in their proposals but miss out on the key points. Your proposal should include a brief description of what you’ll be talking about, the audience that it’s intended for and anything else that you think would be useful for the audience. Keep it Short Conferences get a lot of talk proposals. PyCon US got 450 submissions for 114 slots. DjangoCon Europe got 74 submissions for 20 slots. With such competition the reviewers have to go over a lot of content. It’s important to keep your proposal short and sweet so you don’t bore the reviewers and risk them skipping over your talk. I haven’t done any statistical analysis but a brief look over the proposals for DjangoCon EU makes it look like the sweet spot for proposal length is 4-7 sentences. Shorter and the reviewers can’t get enough relevant information, longer they get bored and go on to the next … -
Pjax vs JSON
At DjangoCon US 2012 I asked a question about performance after the BDFL keynote on Pjax. Asking about performance is never a good idea since it is never the most important thing. I was attempting to evaluate Pjax versus the plethora of Javascript based rendering that was being discussed. A common idea was to use the same template language in Django as you use in Javascript. The Meteor keynote explained that just sharing a template language doesn't solve the hard problems of passing the data and the logic about pre-rendering the data to the client. The Django template language is very simple, but it still lets you indirectly run arbitrarily complex code. All of that logic either has to be reimplemented on the client or the results magically exposed there. Pjax keeps rendering of templates on the server side and uses push state and ajax to optimize the user experience by avoiding page refreshes. Blocks of HTML are send from the server and installed on the existing page. I was looking for a comparison of the performance of Pjax vs Javascript rendering, which in the end isn't a simple question to answer. Even so I think it is worth having … -
Pjax vs JSON
At DjangoCon US 2012 I asked a question about performance after the BDFL keynote on Pjax. Asking about performance is never a good idea since it is never the most important thing. I was attempting to evaluate Pjax versus the plethora of Javascript based rendering that was being discussed. A common idea was to use the same template language in Django as you use in Javascript. The Meteor keynote explained that just sharing a template language doesn't solve the hard problems of passing the data and the logic about pre-rendering the data to the client. The Django template language is very simple, but it still lets you indirectly run arbitrarily complex code. All of that logic either has to be reimplemented on the client or the results magically exposed there. Pjax keeps rendering of templates on the server side and uses push state and ajax to optimize the user experience by avoiding page refreshes. Blocks of HTML are send from the server and installed on the existing page. I was looking for a comparison of the performance of Pjax vs Javascript rendering, which in the end isn't a simple question to answer. Even so I think it is worth having … -
Getting to know the Django Community
Joining the ProjectIn order to ascertain a better sense of the community surrounding Django, I followed the advice listed on the project's Contributing to Django page. Initially I began by joining their Internet Relay Chat (IRC) channels on freenode.net. Not wanting the hassle of determining which IRC client to use, I opted for the webchat service on freenode. Although it has been well over a decade since my last ventures into IRC, it appeared not much had changed on the surface, but I am positive as I continue to use IRC I will begin to find the changes.The django project currently operates two IRC channels, #django for django users, and #django-dev for django development. Unsurprisingly, there was stark difference between the two rooms. #django was lively with several users asking questions of various complexities. While not all of the questions were answered (at least in the main chat), the answers provided were in a polite and helpful fashion. In contrast #django-dev was completely silent. Additionally while I can peruse the #django logs at http://django-irc-logs.com/ I am currently unable to find a similar logging site for the developers channel.FunkyBob once again solving a user's issue.The next step in the process of acclimating … -
Beginner's Guide to PyCon 2013 Part I
New to Python and thinking about going to the upcoming PyCon US for the first time? You know, that big Python conference taking place near San Francisco in March? Or perhaps you signed up already and are getting worried about being overwhelmed by hundreds of tutorials, talks, and activities? No worries! This multi-part guide will aid you in getting the most out of attending one of the best technical conferences on the planet. I'm going to share how to get through the whole event in good shape and cover some incredible beginner friendly events. The Basics First off, register already! PyCon US sold out last year around this time. Don't be left out in the cold. Buy your ticket now before it's too late! Now that you've got that done, keep in mind that Python has two days of tutorials, three days of talks, and four days of sprints. Nine days of Python! The trick is to not get exhausted or sick. Therefore, do the following every day of the conference: Take at least one shower. Please. Eat at least two good meals. Make a point of sitting with different people at each meal and introducing yourself. Make new friends! … -
Beginner's Guide to PyCon 2013 Part I
New to Python and thinking about going to the upcoming PyCon US for the first time? You know, that big Python conference taking place near San Francisco in March? Or perhaps you signed up already and are getting worried about being overwhelmed by hundreds of tutorials, talks, and activities? No worries! This multi-part guide will aid you in getting the most out of attending one of the best technical conferences on the planet. I'm going to share how to get through the whole event in good shape and cover some incredible beginner friendly events. The Basics First off, register already! PyCon US sold out last year around this time. Don't be left out in the cold. Buy your ticket now before it's too late! Now that you've got that done, keep in mind that Python has two days of tutorials, three days of talks, and four days of sprints. Nine days of Python! The trick is to not get exhausted or sick. Therefore, do the following every day of the conference: Take at least one shower. Please. Eat at least two good meals. Make a point of sitting with different people at each meal and introducing yourself. Make new friends! … -
The Making Of The "Getting Started With Django" Music
The Making Of The "Getting Started With Django" Music -
Two Scoops of Django FAQ
The launch of the Two Scoops of Django: Best Practices for Django 1.5 book has gone pretty well. The response has been almost entirely positive and sales have been pretty brisk. We've gotten a ton of great, constructive editorial feedback, which we're sorting through as we race towards the BETA release. Here are answers to the commonly asked questions: When can I buy the book via PayPal? We will support PayPal in either the BETA or FINAL release of the book. In order to handle PayPal we need to find a reputable e-publisher that supports it that gives us similar rates, customer service, and product control (updates at any time, uploads of PDF, no surprise charges, etc) as Gumroad. If you know of an e-publisher who is willing to provide that same level of service, please let me know. For the record, we aren't leaving Gumroad. We just want to support developers and students who don't have credit cards. note: While we could certainly write our own publishing platform, that would delay work on the book. ;-) When can I get a Kindle (mobi) or ePub version? Our plan is to support those formats in either the BETA or FINAL … -
Two Scoops of Django FAQ
The launch of the Two Scoops of Django: Best Practices for Django 1.5 book has gone pretty well. The response has been almost entirely positive and sales have been pretty brisk. We've gotten a ton of great, constructive editorial feedback, which we're sorting through as we race towards the BETA release. Here are answers to the commonly asked questions: When can I buy the book via PayPal? We will support PayPal in either the BETA or FINAL release of the book. In order to handle PayPal we need to find a reputable e-publisher that supports it that gives us similar rates, customer service, and product control (updates at any time, uploads of PDF, no surprise charges, etc) as Gumroad. If you know of an e-publisher who is willing to provide that same level of service, please let me know. For the record, we aren't leaving Gumroad. We just want to support developers and students who don't have credit cards. note: While we could certainly write our own publishing platform, that would delay work on the book. ;-) When can I get a Kindle (mobi) or ePub version? Our plan is to support those formats in either the BETA or FINAL … -
From the Bazaar: Django and Sugar Labs
FOSS Experiences and Reflections* Update: Add section on my experiences with Sugar OS.Eric Raymond's essay The Cathedral and the Bazaar is an intriguing look at the differences between the closed and open approaches in software development. Raymond defines the closed approach as being akin to building a cathedral, small teams or individual geniuses meticulously designing and crafting the software, but never sharing until the project is completed. The author contrasts this with the open source approach epitomized by the development of the Linux OS kernel. This style, labeled the bazaar style, is marked by its mix of different agendas & development approaches, soliciting and using contributions from people outside of the main development team, and releasing software and updates early and often. While the author clearly prefers the bazaar style of development, I still believe both approaches have a place in software development. One can point to many successful implementations of the bazaar approach like GIMP or Perl, and surely no one can deny the accomplishments of software cathedrals such as Apple's iOS or Mac OS X.After the brief introduction of the cathedral and bazaar concepts, Raymond proceeds to detail his stewardship over the open source program, fetchmail, and the development of Linux OS as … -
Startups and Django
We've been working with more and more startups that are already using or have decided to use Django for their new web-based businesses. It's exciting. We've known for some time that Django is well suited for the kind of rapid iterations required for start-up firms. Now that ... -
Reusable Django Tests
Reusable Django Tests First of all, I think that testing should be accessible to everyone and should be simple enough to just "plug in" some automated tests for common patterns. Django does a pretty awesome job at encompassing applications. An application may be a blog, or a voting system, or one of many other components that require minimal configuration. These applications lower the barrier to writing larger systems. These applications come from the idea that a lot of these pieces share the same basic pieces across different projects, e.g. everyone's tagging system is going to support the same core necessities. What if we were able to identify common testing patterns and were able to generate tests that automatically introspect and make assertions about our app for us? Then we could just install a new application, apply some basic configuration, and boom! Instant tests without needing to actually write them yourself. I want to start tackling this problem and begin identifying patterns that can be extrapolated out into their own suite that is just installed and ready to go. Introducing: Proofread My first attempt at a solution to this is a project I've called proofread. Proofread tests the very basics of … -
Reusable Django Tests
Reusable Django Tests First of all, I think that testing should be accessible to everyone and should be simple enough to just "plug in" some automated tests for common patterns. Django does a pretty awesome job at encompassing applications. An application may be a blog, or a voting system, or one of many other components that require minimal configuration. These applications lower the barrier to writing larger systems. These applications come from the idea that a lot of these pieces share the same basic pieces across different projects, e.g. everyone's tagging system is going to support the same core necessities. What if we were able to identify common testing patterns and were able to generate tests that automatically introspect and make assertions about our app for us? Then we could just install a new application, apply some basic configuration, and boom! Instant tests without needing to actually write them yourself. I want to start tackling this problem and begin identifying patterns that can be extrapolated out into their own suite that is just installed and ready to go. Introducing: Proofread My first attempt at a solution to this is a project I've called proofread. Proofread tests the very basics of … -
Two Scoops of Django
Ahir vai acabar de llegir "Two Scoops of Django", el nou llibre, encara en versió Alfa que han tret DAniel Greenfeld i Audrey Roy. A diferència d'altres llibres que t'ensenyen a programar o et mostren el funcionanment d'un framework de programació, aquest llibre no és un tutorial per als no iniciats, sinó més bé una mena de consultoria de millors pràctiques en forma de llibre. Els autors "es banyen", recomanant utilitats i maneres de fer les coses per tal que els nostres projectes siguin més bons de desplegar i mantenir. Es recomanen llibreries externes per a facilitar-nos la vida: South, Virtualenv, Virtualenvwrapper (vells coneguts també per aquest blog) i fins i tot entra en la petital polèmica que hi ha damunt si és millor fer-ho tot amb CBV, fer una mescla o no fer-les servir. Puc dir que estic gairebé al 100% d'acord amb totes les recomanacions. Val a a dir que hem arribat a les mateixes conclusions que els autors en garebé tots els aspectes. Fins ara no feiem servir les variables d'entorn i és una cosa que de ben segur ens mirarem amb cura. Punts que potser estaria bé tractar o de discrepància: Nom del projecte. Personalment no … -
Release 0.7.7
We just released LFS 0.7.7. This is a yet another bugfix release of the 0.7 branch. Changes Update: updated Czech translation (Radim Novotny). Update: updated Mexican translations (tzicatl). Improvement: Don't use more than one h1 tag on the product page but use h1 and h2 (Radim Novotny). Improvement: Show search query in the input box if there is any query. Also added pagination to the bottom of search results page (Radim Novotny). Bugfix: fixed calculation of discount net price within order; issue #36 Bugfix: fixed display of amount for discounts within management. Bugfix: fixed sorting handling for SOLR (Radim Novotny) Bugfix: fixed display of properties for locale. Bugfix: fixed calculation of 'calculated price' for different locales. Bugfix: fixed calculation and display of packings. Bugfix: fixed display of variant property values within products management. Information You can find more information and help on following locations: Documentation on PyPI Demo Releases on PyPI Source code on bitbucket.org and github. Google Group lfsproject on Twitter IRC -
Our Django Book Has Launched
We (Audrey Roy and I) wrote a book on Django! It's called Two Scoops of Django: Best Practices for Django 1.5, and you can buy it right now in e-book (PDF) form on the website: http://django.2scoops.org. Django, like any framework, has tips, tricks, and pitfalls that aren't documented in one place. Experienced developers know this stuff, but gleaning it off the Internet takes a lot of time. We decided to take everything we know and write it down. This book reflects a portion of what we documented, and if it does well we plan to follow it up with other references. If you've followed this blog or watched our talks you've know we've explained tons of Django and Python related examples. We enjoy using Django and Python to build stable, fast web applications quickly and efficiently. This is the book we would have wanted while learning the intricacies of our tools, and then kept it handy for reference. In the book we cover everything from customizing the Django 1.5 User model, forms, views, templates, security, bottleneck analysis and so much more. We tie in third-party packages from the Django and Python community. We discuss the positive patterns that allow for … -
Our Django Book Has Launched
We (Audrey Roy and I) wrote a book on Django! It's called Two Scoops of Django: Best Practices for Django 1.5, and you can buy it right now in e-book (PDF) form on the website: http://django.2scoops.org. Django, like any framework, has tips, tricks, and pitfalls that aren't documented in one place. Experienced developers know this stuff, but gleaning it off the Internet takes a lot of time. We decided to take everything we know and write it down. This book reflects a portion of what we documented, and if it does well we plan to follow it up with other references. If you've followed this blog or watched our talks you've know we've explained tons of Django and Python related examples. We enjoy using Django and Python to build stable, fast web applications quickly and efficiently. This is the book we would have wanted while learning the intricacies of our tools, and then kept it handy for reference. In the book we cover everything from customizing the Django 1.5 User model, forms, views, templates, security, bottleneck analysis and so much more. We tie in third-party packages from the Django and Python community. We discuss the positive patterns that allow for … -
Our Django Book is Finished
We (Audrey Roy and I) wrote a book on Django! It's called Two Scoops of Django: Best Practices for Django 1.5, and you can buy it right now in e-book (PDF) form on the website: http://django.2scoops.org. Django, like any framework, has tips, tricks, and pitfalls that aren't documented in one place. Experienced developers know this stuff, but gleaning it off the Internet takes a lot of time. We decided to take everything we know and write it down. This book reflects a portion of what we documented, and if it does well we plan to follow it up with other references. If you've followed this blog or watched our talks you've know we've explained tons of Django and Python related examples. We enjoy using Django and Python to build stable, fast web applications quickly and efficiently. We've also worked This is the book we would have wanted while learning the intricacies of our tools, and then kept it handy for reference. In the book we cover everything from customizing the Django 1.5 User model, forms, views, templates, security, bottleneck analysis and so much more. We tie in third-party packages from the Django and Python community. We discuss the positive patterns … -
Our Django Book is Launched
We (Audrey Roy and I) wrote a book on Django! It's called Two Scoops of Django: Best Practices for Django 1.5, and you can buy it right now in e-book (PDF) form on the website: http://django.2scoops.org. Django, like any framework, has tips, tricks, and pitfalls that aren't documented in one place. Experienced developers know this stuff, but gleaning it off the Internet takes a lot of time. We decided to take everything we know and write it down. This book reflects a portion of what we documented, and if it does well we plan to follow it up with other references. If you've followed this blog or watched our talks you've know we've explained tons of Django and Python related examples. We enjoy using Django and Python to build stable, fast web applications quickly and efficiently. We've also worked This is the book we would have wanted while learning the intricacies of our tools, and then kept it handy for reference. In the book we cover everything from customizing the Django 1.5 User model, forms, views, templates, security, bottleneck analysis and so much more. We tie in third-party packages from the Django and Python community. We discuss the positive patterns … -
Django Suite IV: Hablemos un poco de caché.
Decía Phil Karlton "Solo hay dos cosas dificiles en las ciencias de la computación: invalidación de caché y nombrar cosas." En esta entrega de la serie Django Suite - después de mas de un año de ausencia - hablaré sobre el framework de caché de Django. Principios de caché Cuando hacemos un sitio, especialmente si estamos comenzando no tomamos en cuenta el desempeño del sitio y la cantidad de tiempo de procesamiento por cada petición. El tiempo de procesamiento de un sitio está afectado por varios factores el mas importante la cantidad de consultas que realizamos a la base de dato por cada request, generalmente estas varían según la complejidad de nuestras vistas y el tipo de usuario (anónimo o autenticado) que tengamos en el sitio. Para mejorar el desempeño del sitio se usa el caché que no es mas que un almacenamiento rápido, generalmente en RAM, que nos evita recaer en operaciones de cálculo pesadas como lo son hacer muchas consultas de base de datos la lógica de las vistas y el renderizado de las mismas en la plantilla que normalmente son realizadas haciendo lectura/escritura de disco duro que agrega mas tiempo a la receta. Hacer caché de datos …