Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Spatial Bookmarking Service goes Open Source
Locidesktop was my coffee shop coding project of last year. I was quite pleased with the results. Locidesktop.com has been happily serving link desktops to some loyal visitors for months now – with no maintenance required on my part (a good thing because I've been busy with other projects). Rather than let the project stagnate while I do other things, I have released it as open source with the hope that other Python/Django developers will pick it up and add new features. I had never really anticipated that anyone other than myself would see the code, so it is lacking in comments and documentations, but there are some nice features that may be of interest. For instance, there's a system to expose a REST API that factors out a lot of Python bioler-plate code and corresponding javascript code exposes the desktop functionality to the browser. There's also a pretty powerful caching system that makes rendering a desktop blindingly fast. I may have gone overboard with that, given my traffic rates. But I guess it is best to have more capacity than you need. If you want to look through the code or fork the project, it is available on Github: … -
Stupid Template Languages
For years I've been absolutely certain that I really prefer stupid template languages any time I'm generating HTML. The less the template language can do the better. Since I spend most of my time coding in Python you might assume this applies just to Python, but I think it also applies to anything where you have the power to readily mix HTML generation and code.The biggest annoyance I have with smart template languages (Mako, Genshi, Jinja2, PHP, Perl, ColdFusion, etc) is that you have the capability to mix core business logic with your end views, hence violating the rules of Model-View-Controller architecture. While the web can be hard to match to MVC, in general you aren't supposed to do that sort of thing. I've made the mistake of putting core logic in the wrong places in the past, but I'm proud to say I've gotten good at avoiding that particular mistake.I don't work in a vacuum.I often work on projects crafted by others, some who decided for arcane/brilliant/idiotic reasons to mix the kernel of their applications in template function/macros. This is only possible in Smart Template Languages! If they were using a Stupid Template Language they would have been forced put their kernel code in … -
LinkShare Pixel Tracking template tag for usage with Satchmo
I've implemented LinkShare Pixel Tracking for Satchmo-based stores — Django Snippet #2314. Very simple template tag which use info from current order and generate Pixel Tracking image link. -
Django forms ChoiceField and custom HTML output…
… or what to do in case that you need a special design for your choice fields The problem: Few posts ago I talked(wrote) about Django forms ChoiceField and with dynamic values and now it is time to take a look at the front end and how we display these values to the user. I [...] -
Extending Django CMS Page model – part III
… or the drawback of Extending Django CMS Page model – part II First of all please accept my apologies that I couldn’t warn you for this drawback earlier but I was really busy in the last few weeks so let’s skip directly to the problem. If you remember in Extending Django CMS Page model [...] -
Serving favicon in an Django App using Apache
I got a free few minutes to work on my own site here. Since I migrated the site from all static pages to Django served, I still haven’t put back the favicon icon back onto the site. The sites runs under a virtual host in apache2 at WebFaction. This is what you need to put [...] -
Django CSRF Migration
Like many of you, I am migrating all my Django sites to Django 1.2.1. For sites that are currently in production, I am doing the slow migration route. Just trying to get the site up with 1.2 without using any of the new features yet. One thing that I ran into is the new CSRF [...] -
Django South Explained
Posted my tutorial on using Django south, the database migration tool, over at DjangoPro. Check it out! -
Resetting Django Admin Password
This barely qualifies for a blog post, but what to do if you loaded, via django-admin.py loaddata a full json file from someone during testing, and don’t have their user’s password? Just run the django-admin.py shell, and by hand reset all the passwords: from django.contrib.auth.models import User for u in Users: u.set_password(‘secret’) u.save() That’s why [...] -
Django Production Error Handler
I am working on an application that, besides providing a dynamic website, also talks to an iPhone application. What happens when the iPhone, or a web visitor, triggered a bug in the application? Django actually provide a nice mechanism to report error in its “batteries included” goodness. You can easily setup the Django environment so [...] -
Fix Python source code to use spaces instead of tabs
What if someone gave you a Python source file that is indented using tabs? If you are using emacs, the following will let you convert it back to using spaces: # first set the buffer tab width to 4 (or whatever you like) M-x set-variable <return> tab-width <return> 4 # then mark the entire file [...] -
Paul Bissex Presenting at the Boston Django Meetup 2010
Paul Bissex, author of “Python Web Development with Django”, described how he use Django to replace two legacy desktop applications at hallmark.edu at the Boston Django meetup this month. Because of Django’s ease of use and robustness, not only he replaced and deploy those apps easily, the apps has been running error free for a [...] -
Jacob Kaplan-Moss on DevOps
Jacob gave a talk at the Boston Django Meetup this month on the topic of DevOps — The role of the developer and the role of sysadmin are merging, and it is a good thing. This idea certainly resonate with me. I started my career as a DevOps by necessity — I worked with a [...] -
My Accidental Connection with Senator Ted Kennedy
Being Chinese in Boston, I always hear positive stories about the late Senator Ted Kennedy helping immigrants. In addition, I agree with most of his political views, he seemed like a good Senator. After learning of his death, I felt we had lost a great man. I added one of his biographies to my Amazon [...] -
I am in the NY Times, sorta
Check out the NYTimes article on WilsonDailyPrep. We at Imperial Consulting did the application, using Django and Python. It is a great service and a lot of fun to work on (my own vocab and grammar has gotten better, the Math quizzes are too easy). I am glad it is getting the big time publicity [...] -
How to actually make LocalSolr work
Today I've been working on integrating geospatial search with our upcoming DISQUS Search product, which happens to rely on Solr. It didn't take much work before I stumbled upon LocalSolr, which seems to be the defacto gis implementation. The docs were fairly brief, but it seemed easy to get up an... -
The Definitive Guide to Installing Django on Ubuntu
Make sure you install django. -
The Definitive Guide to Installing Django on Ubuntu
Make sure you install django. -
Resolutions for 2011
Travel to Europe again.Travel to Asia or Africa.Visit a Disney park.See a place in the USA I've never been.Drop the waist size 2 inches and not break any bones.Go to Pycon and present or teach.Go to DjangoCon and present or teach.Present at LA DjangoContinue my Muay Thai and Capoeira studies, get back into Eskrima, learn some more BJJ, and practice the forms I know.Work out at least three times a week.Go back east and teach martial arts for a day.Finish some outstanding legal proceedings.Launch a site that does cool stuff and somehow brings in money.Get to the point with LISP where I can do cool stuff in it without needing a textbook.Blog once a week. That is at least 52 blog entries!Explain why I wrote Diversity Rocks. -
Django-UserGroup Hamburg jetzt mit festen Terminen
Ab 2011 trifft sich die Django-UserGroup Hamburg (dughh) immer am zweiten Mittwoch in allen ungeraden Monaten um 19:30 Uhr. Die nächsten drei Termine sind also: 12. Januar 09. März 11. Mai Alle Termine sind über den folgenden Link als Google Kalender verfügbar: http://bit.ly/bL1kqz Um den Kalender im eigenen Google Kalender hinzuzufügen kann man folgende ID benutzen: npmdepcp52p5futhnoo0cgacg0@group.calendar.google.com Um den Kalender in anderen Kalender-Programmen einzubinden kann man folgenden Link für das iCal Format benutzen: http://www.google.com/calendar/ical/npmdepcp52p5futhnoo0cgacg0%40group.calendar.google.com/public/basic.ics Abgesehen von den Terminen ändert sich erstmal nichts. Die Treffen finden weiterhin bei CoreMedia statt. Mehr Informationen gibt es im Wiki des Deutschen Django Vereins. -
2010: A Year in Review
2010 was a great year for RevSys and for Jacob and I, both personally and professionally. Here are some of the highlights: Jacob gave a ton of training classes around the US in cities such as NYC, Boston, Los Angles, and Atlanta. Between his training schedule and speaking engagements he managed to log close to 60,000 miles of travel hitting 31 cities in 4 countries this year. I'd list links to all of Jacob's talks this year, but unfortuantely our webserver doesn't have enough storage for that large of a list! (Ok I'm lying, I'm just lazy and running late for a New Year's Eve party.) We gave a half day tutorial at OSCON on deploying Django. I gave a talk at DjangoCon and we helped sponsor the conference this year. It was also the first time I got to meet Steve Holden We were able to work with some of the best developers other there this year on projects, people such as Malcolm, Danny, Daniel, and Travis. Danny even camped out with us at Chez Revsys for a few months while he taste tested Lawrence. We refreshed our site with the amazing help of Greg Newman and Ed Frazier. … -
Django and Bleach
Bleach is a HTML whitelist and sanitizer library written by James Socol. At mozilla we use it on the addons and support sites. Chances are you'll need it on pretty much any site that accepts user input, ensuring that the HTML you are outputting is nice and safe. Under the hood bleach uses the html5lib. As an aside, I've been running html5lib sanitisation using a homegrown library on App Engine for a while now and it's been great. Installing bleach is as simple as: pip install bleach The place to do user validation is a form, so let's take a simple model and form combination: from django.db import models class Todo(models.Model): text = models.CharField(max_length=255) from django.forms import ModelForm from bleach import Bleach from todo.models import Todo bleach = Bleach() class TodoForm(ModelForm): def clean_text(self): return bleach.clean(self.cleaned_data.get('text', '')) class Meta: model = Todo And that's it, our Todo model is now going to be nicely sanitised (assuming you use a django form for validating all user input, which you should do). So here's a quick test: import unittest from todo.forms import TodoForm class TestBleach(unittest.TestCase): def test_todo(self): data = "<b>bold</b> <script>alert('hello')</script> " expect = "<b>bold</b> &lt;script&gt;alert('hello')&lt;/script&gt;" form = TodoForm({'text':data}) assert form.is_valid() assert form.cleaned_data['text'] … -
Django-easy-maps, c’est comme google maps, mais dans ton site
Cette année se finira comme elle a commencé, en bossant et avec beaucoup moins de temps que ce que j'aimerais en avoir. Il y a pas à dire, il faut vraiment que je me remette à jouer au loto, histoire de pouvoir rêver à un jour, avoir tout le temps que j'aimerais avoir. Mais ne ... -
Autocompletion for Django models using Solr, Redis or SQL
One of the nicest UI's around when dealing with a large dataset is a good autocomplete. Facebook's search is a great example, same for Netflix, and recently Google launched "Google Instant", which returns search results as you type. Autocomplete can really complement hierarchical drill-down search (which is useful for discovery), as the goal of autocomplete is more for helping users find something they already know about with a minimum of effort. django-completion The goal of django-completion is to make adding autocompletion to your django project super easy. It follows the by-now-standard pluggable backend/registry approach, so its on you to write "providers" for the models you want to enable autocomplete on. Luckily, there's only a handful of methods you need to implement. Supposing you wanted to allow autocomplete on users, here's what a "User" provider might look like: syntax:python from django.contrib.auth.models import User from completion.sites import AutocompleteProvider, site class UserProvider(AutocompleteProvider): def get_title(self, obj): """This is the phrase that will be 'autocompleted'""" return obj.username def get_pub_date(self, obj): return obj.last_login def get_data(self, obj): """ Any arbitrary data you want stored in the index, which will be returned when a search is performed """ return { 'username': obj.username, 'email': obj.email, 'avatar_url': obj.profile.avatar, 'profile_url': obj.get_absolute_url() … -
Смена места
Пятница 24 декабря была моим последним днём работы в московском офисе Яндекса. Как многие уже в курсе, мы с Алёной переехали в Сиэтл. Она будет работать в Bing, а я получил от Яндекса чудесное предложение быть внештатным консультантом, которое с радостью и принял. Было Моя главная работа в Яндексе заключалась в руководстве группой разработчиков, которая занималась разными проектами, но была объединена по технологическому признаку: мы пишем веб-сервисы на Питоне. Была ещё дополнительная, хоть и не менее важная, часть работы — поддержка и развитие питоньего стека технологий: Джанго, утилиты, сборочный процесс, документация. Должен признаться, этой частью работы мне совершенно сознательно приходилось жертвовать в пользу менеджмента. Стало Смена места жительства автоматически означает, что заниматься менеджерской частью я уже не смогу. Поэтому моя прежняя дополнительная нагрузка просто станет основной. И это как раз то, что мне так нравится. Мне давно хочется навести порядок в джанговском хозяйстве в Яндексе, довести его до современного уровня и автоматизировать, чтобы не тратить лишних телодвижений на инфраструктуру, демплоймент, мониторинг… Ещё одно дело, которое я не собираюсь бросать — это работа над различными API для Яндексовых сервисов. Пока что ни одно из них не стало хитом, но у меня есть идеи о том, как это можно исправить. Документирование, реализация …