Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Alternatives to using Celery
I’ve found some candidates for replacing Celery in my company’s product. (My reasons for replacing it are elucidated here, here, and here.) I got these from web trawling, blog comments, and some e-mail. At first blush, none of the candidates have any disqualifying attributes, except for lacking subtasks. Celery is the only Python-friendly asynchronous task technology with subtask support, so I’ll need to bend on that if I want any alternatives to consider. (If I’m wrong on this point, please let me know in the comments!) I’m not saying that these candidates will definitely satisfy all (sans subtasks) of my requirements. Right now they’ve just passed my initial sniff test. The next step will be to read documentation in detail, assess the health/activity of its community and developers, and try some sample code. The candidates Huey: Web-accessible docs are here. (What is it with projects using Read the Docs? Read the Docs irks me. The stupid icon in the bottom right corner laughs at me.) Doesn’t have subtasks, and the management API amounts to reading the queue from Redis and pawing through it… Gearman with python-gearman and/or django-gearman: Configuration seems more complex than Huey, but with little effort I found … -
Having Fun with the Redactor WYSIWYG Editor
I have been having a blast with redactorjs and will soon be buying a developer license. This past weekend I rewrote my blog to use this new editor instead of the custom Django admin markdown-based editor I had been using. I really love the experience of authoring content in exactly the the same style that it will appear in the site. Unlike other HTML editors, this one is clean and simple and just gets out of the way. -
DjangoCon 2012 - Eating in DC
A caveat: When I'm eating in DC, it's usually because there's a Capitals game going on. I have very deep knowledge of the food options near the Verizon center and that's about it. Happily, DC people are heavy users of Yelp and such, so finding the good places isn't too difficult. I highly recommend making reservations if you can. DC is unpredictable. I've walked into a restaurant on Friday night and found it dead. I've gone back a few weeks later on a Tuesday, and it's jammed. You don't know when conferences will be in town, so just save yourself some heartache and use Open Table. That said, here's my list of places to eat and drink in DC! Near the hotel The hotel is near quite a bit of food. Some of the restaurants are chains (though higher-quality chains) and some are family owned. My favorites: Kabob Place - As many commenters from my last post said, OH MY GOD. This place is awesome. Fantastic kabobs, and now they have a sit-down restaurant along side the original. You get a ton of food, but prepare to wait. Ted's Montana Grill- A chain, but I've yet to be disappointed there. Get the … -
Django-photologue: a new release, and a new maintainer
The django-photologue project gets a new maintainer... me! -
(NL) Python/Django vacature in Utrecht
Note for English speakers: due to the nature of the work, you'll only be really happy if you can speak Dutch, so I'm sticking to Dutch for the rest of this post. Door vakantie ben ik er niet aan toegekomen het eerder te posten, maar... we zoeken weer versterking. Want ik ben er ook niet aan toe gekomen omdat het druk is qua werk :-) En de deadline is maandag 20 augustus 's ochtends vroeg. Da's dus rap. Zie de officiele vacature. Je mag lekker aan de slag met Python en Django, dat zal tenminste de hoofdmoot zijn. Verder heeft iedereen bij ons wel iets extra's. De een is ook goed in serverbeheer. Of in automatiseren. Of coffeescript. Of css'en. Binnenkort zullen we ook meer met NoSQL gaan doen voor een die-krijgen-we-hopelijk grote opdracht. Of misschien optimaliseer je graag een postgresql database. Python en Django zijn dan wel de hoofdmoot, maar lang niet iedereen die bij ons begint te werken is ermee bekend. Beiden zijn snel aan te leren. Dus als je snel een nieuwe taal op kunt pikken is het ook goed. Sowieso maakt het niet heel veel uit of je nou heel ervaren bent of niet: Als je … -
Django-photologue: a new release, and a new maintainer
The django-photologue project gets a new maintainer... me! -
Django urlpattern nested regex groups
Had one of those annoying things that I could not figure out why it was not working; learned something about how django's url routing works along the way. I created a new view for within the admin, that provides a summary of the permissions associated with a group, or set of groups. For our purposes, a company can have a number of groups associated with it, so I wanted to be able to optionally provide a company id: if it was provided, it would only show the groups+permissions for that company; if not provided it should show all of the groups and their permissions. So, I had the urlpattern like: {% highlight python %} # Included under '/company/...' url(r'^((?P\d+)?/)?groups/$', 'group_perms', name='company_group_permissions'), {% endhighlight %} This resolves fine. All of these variations work as expected: http://example.com/company/10/groups/ http://example.com/company/groups/ http://example.com/company//groups/ However, I wanted to put a link in the admin change page for the company class, but was getting resolution errors, so I tried reverse directly: {% highlight python %} reverse('group_perms', kwargs={'company': 10}) # -> NoReverseMatch: Reverse for 'group_perms' with # arguments '()' and keyword arguments '{}' not found. {% endhighlight %} That's odd. Maybe I was getting the name or something wrong: … -
My requirements for replacing Celery
I’m ready to start looking at candidates to replace Celery in my company’s product. (The reasons are elucidated here, here, and here.) Our SaaS product provides data mining and visualization for intellectual property. A 10-second elevator pitch is, it’s as though we attached Microsoft Excel’s chart wizard to US and international patent offices. (“As though” = “We didn’t do that, and in fact we go way beyond that, but I’m giving you a simple description.”) Our code is 100% Django and Python. I looked at how we use Celery in our codebase. The reality of how we use it is much simpler than our ideas when we started two years ago. Combining our existing features with our product roadmap, I know with high confidence what features we need for our asynchronous tasks. And which ones are nice to have but not required, and which ones we’ll probably never need. Here are my Celery replacement requirements. Except for the “I don’t need” or “Tasks don’t have to…” statements, they’re all about equally important. The non-deprecated section of the API does not change often. New code releases have one of two attributes: They’ll be 100% backwards compatible, or they’ll have clear instructions … -
Nodejsconf 2012
Nodejsconf 2012 (italian version below) Here we are, again! Last year, as you probably know, we organized the first Italian conference about NodeJS. We had over 200 participants from across Europe and sessions by international speakers such as Sergi Mansilla (Cloud9IDE ), Arnout Kazemier (Socket.io), Ian Jorgensen (pubsub.io), Gabriele Lana, Golo Roden, Andy Kent (Forward) and Oleg Podsechin. During the conference there was also a workshop held by Gabriela Lana, focused on creating the game "Rock, paper, scissor, lizard, Spock" with nodejs. Based on last year success and the continuously growing interest in NodeJs, WEBdeBS decided to go at it again: the Second Edition of the NodeJs Conference will be held on November 10th 2012 in Brescia. The cfp is open, till September 10th: https://github.com/WEBdeBS/nodejsconf2012 When/Where? The second Italian NodejsConf will be held in Brescia(north of Italy, 70 km from Milan ) Saturday the 10th of November. The same day the Nodeknockout event will start, so we will be providing a room where you can hack with node. At the end of the conference the hackathon will continue in TalentGarden a coworking space, where GrUSP, jsDay organizer, will provide food and beverage. How you can help us? We are looking for speakers and sponsorship that can help us … -
Nodejsconf 2012
Nodejsconf 2012 body,.backgroundTable{ background-color:#eeeeee; } #contentTable{ border:0px none #000000; margin-top:10px; } .headerTop{ background-color:#26292e; border-top:0px none #000000; border-bottom:0px none #FFCC66; text-align:center; padding:0px; } .adminText{ font-size:10px; color:#333333; line-height:200%; font-family:Helvetica; text-decoration:none; } .headerBar{ background-color:#26292e; border-top:0px none #333333; border-bottom:0px none #FFFFFF; padding:0px; } .headerBarText{ color:#333333; font-size:30px; font-family:Helvetica; font-weight:normal; text-align:left; } .postcardBarText{ color:#333333; font-size:30px; font-family:Helvetica; font-weight:normal; text-align:center; } .title{ font-size:24px; font-weight:bold; color:#4A8797; font-family:Helvetica; line-height:150%; } .subTitle{ font-size:14px; font-weight:bold; color:#000000; font-style:normal; font-family:Helvetica; } .defaultText{ font-size:12px; color:#333333; line-height:150%; font-family:Helvetica; background-color:#FFFFFF; padding:20px; border:0px none #FFFFFF; } .footerRow{ background-color:#26292e; border-top:0px none #FFFFFF; padding:20px; } .footerText{ font-size:10px; color:#666666; line-height:100%; font-family:Helvetica; } a,a:link,a:visited{ color:#17488a; text-decoration:underline; font-weight:normal; } .headerTop a{ color:#26292e; text-decoration:none; font-weight:normal; } .footerRow a{ color:#465F5D; text-decoration:underline; font-weight:normal; } body,.backgroundTable{ background-color:#26292e; } (italian version below) Here we are, again! Last year, as you probably know, we organized the first Italian conference about NodeJS. We had over 200 participants from across Europe and sessions by international speakers such as Sergi Mansilla (Cloud9IDE ), Arnout Kazemier (Socket.io), Ian Jorgensen (pubsub.io), Gabriele Lana, Golo Roden, Andy Kent (Forward) and Oleg Podsechin. During the conference there was also a workshop held by Gabriela Lana, focused on creating the game "Rock, paper, scissor, lizard, Spock" with nodejs. Based on last year success and the continuously growing … -
Changing Django cache backend between test cases
Changing Django cache backend between test cases It’s a good practice to run tests for a Django project with a dummy cache backend. This eliminates side effects of one test from affecting the results of other tests. Here’s how to activate the dummy backend in a Django settings file: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache' } } However, sometimes it’s also necessary to test how an application uses the cache. In this article, we’ll show how to replace the dummy cache with a real cache backend separately for individual test cases. We’ll use the trivial myapp/mymodule.py below as example code under test: 1 2 3 4 5from django.core.cache import cache def myfunc(key): cache.set(key, 'myvalue') The obvious (but alas, wrong) way One solution is to create a separate test suite with its own test settings. The drawback is that it must be run separately even if the tests belong logically together with the rest of the tests. Django 1.4 makes it easy to override settings on a test-by-test basis (see Overriding settings in the testing section of Django’s documentation). It feels natural that the @override_settings decorator should do the trick of enabling caching separately for individual test cases: 1 2 … -
Thoughts after attending the UNICEF Rwanda mHealth Conference
This past July, I had the pleasure of attending the UNICEF Rwanda Conference in Kigali, Rwanda. The conferences focus was on developing a comprehensive eHealth suite for numerous nations to implement. Mobile technology is changing the landscape of public health in Africa, and SMS messaging is leading the way. Conference goers were tasked with organizing the existing mHealth technical infrastructure to reduce redundancy in the existing applications. The goal was to create a comprehensive mHealth software suite for maternal, newborn and child health, nutrition and ending Mother to Child transmission of HIV (eMTCT). The conference also hoped to improve the interoperability of key existing platforms to provide functionality that is currently not possible by using one software tool. Caktus was very excited to take part in this conference and learn more about how developers can assist in these efforts. Recently, Tobias McNulty and I have become RapidSMS community coordinators. In this new leadership role, our goals are to strengthen the existing code infrastructure and help write extensive documentation. The main goal for the RapidSMS project is to be fully usable by UNICEF country offices and other users without sustained support from outside software consultants. Through attending the UNICEF Rwanda conference … -
DjangoCon 2012 - Life in DC
As long as you're in town, you might as well see some of the sights, right? Smithsonian When people come into town, I always point them at the Smithsonian. It's an awesome set of museums that are completely free. You can spend a week going through them and still not see all of the exhibits. They're also only closed two days a year, and neither of those days are during the conference. Some important notes: You have to go through security to get in. They're going to poke around in your bag with a stick. Some places have metal detectors. The art museums are super-uppity about what you can bring in. If you think about it, this makes sense. Their exhibits aren't behind glass. They have a bag check so you can stash your stuff if needed. The museums open at 10am. One of the buildings, the castle, opens early, but there's not much to do there besides drink a coffee and sit in the garden. Pictures are allowed! Bring your cameras and camcorders! Almost all of the museums ring the Mall. The Mall is a big strip of grass in front of the Washington Monument. It does not have … -
QuerySets, Q Objects, datetime, and Far Too Much Context
QuerySets, Q Objects, datetime, and Far Too Much Context -
DjangoCon - DC Tips
Mad props to Jackie Kazil, who helped me write this post! So, coming to DjangoCon in September? Let's have a chat about DC. The location DjangoCon DC is actually in Northern Virginia, not in the heart of the Capitol. Specifically, it's being held in Crystal City at the Hyatt Regency, which is close to the Crystal City Metro Station (the yellow and blue metro lines) and one stop away from Reagan National Airport (DCA). I worked in the area for many years, and while it doesn't have as much of the DC grit and history, it makes up for in being a great nexus between convenience and cost. As someone who's been to several conferences in DC, I can tell you this is a good thing. It is a safe, clean, affordable, and transportation-accessible part of the DC metro area that is littered with Django developers. If, for some reason, you aren't going to be staying at the conference's hotel, you're in luck. DC has a LOT of hotels. In general, the closer they are to a metro stop, the more expensive they are, but it's still possible to find no-frills hotels very close to a metro stop. If you … -
Testing Django applications with Selenium
Selenium is a popular tool for browser automation. Main usage for Selenium are browser based tests of web applications. With a real browser and handy API you can test frontend behavior of an application (like JavaScript code). In Django 1.4 we got LiveServerTestCase - a TestCase that spawns a test server. This allowed much easier Selenium integration in Django tests. You can change a presentation on benlopatin.com. If you will find something different - check the date as it may describe older solutions for older Django versions. In this article I'll show some basic Selenium usage cases in tests - showcasing the api. -
Why escape-on-input is a bad idea
The right way to handle issues with untrusted data is: Filter on input, escape on output This means that you validate or limit data that comes in (filter), but only transform (escape or encode) it at the point you are sending it as output to another system that requires the encoding. It has been standard best practice since just about forever [citation required]. An alternative is “escape on input”: at the point that data enters your system, you apply a transformation to it to avoid a problem further down the line when the data is used. It's come to my attention that some serious web developers (or at least, they take themselves seriously and are taken seriously by others) are still suggesting the practice of escape-on-input. For example, with escape-on-input, to avoid XSS any data that enters your system has HTML escaping applied to it immediately, before your application code touches it. I chose that example deliberately, because people are actually recommending it: in some recent “PHP sucks” debate. which, in turn, linked to a page by Rasmus Lerdorf recommending escape-on-input as a sensible way to deal with XSS. The page, admittedly, is describing a ‘toy’, a ‘no-framework PHP framework’, … -
Curiosity has landed!
I'm terribly proud of what was accomplished last night: A car-sized robot weighing a whopping 8,580 pounds (3,893 kg) was landed on Mars. It is packed with scientific packages that will expand our knowledge of Mars, and has the power to use them for at least 14 years. Simply put, this is an incredible step forward. As an American, I'm proud that our nation is capable of putting together such amazing feats of engineering and science. People from a diverse arrangement of backgrounds and origins came together to make something incredible happen. As a human being, I'm proud that we have yet again proven that we are still capable of working together to make amazing things happen. As someone who grew up in the 1970s, and someone who is proud to have worked at NASA for over 5 years, this is my American dream. Going Forward Curiosity is about to do amazing things and will tell a story to us that we'll never forget. Alas, NASA is a terribly easy target for politicians. It's budget has shrank to a small fraction of the it's early 1970s high, and it remains a target to this day. While the politicians congratulate the … -
Curiosity has landed!
I'm terribly proud of what was accomplished last night: A car-sized robot weighing a whopping 8,580 pounds (3,893 kg) was landed on Mars. It is packed with scientific packages that will expand our knowledge of Mars, and has the power to use them for at least 14 years. Simply put, this is an incredible step forward. As an American, I'm proud that our nation is capable of putting together such amazing feats of engineering and science. People from a diverse arrangement of backgrounds and origins came together to make something incredible happen. As a human being, I'm proud that we have yet again proven that we are still capable of working together to make amazing things happen. As someone who grew up in the 1970s, and someone who is proud to have worked at NASA for over 5 years, this is my American dream. Going Forward Curiosity is about to do amazing things and will tell a story to us that we'll never forget. Alas, NASA is a terribly easy target for politicians. It's budget has shrank to a small fraction of the it's early 1970s high, and it remains a target to this day. While the politicians congratulate the … -
Curiosity has landed!
I'm terribly proud of what was accomplished last night: A car-sized robot weighing a whopping 8,580 pounds (3,893 kg) was landed on Mars. It's packed with scientific packages which will expand our knowledge of Mars, and has the power to use them for at least 14 years. Simply put, this is an incredible step forward. As an American, I'm proud that our nation is capable of putting together such amazing feats of engineering and science. People from a diverse arrangement of backgrounds and origins came together to make something incredible happen. As a human being, I'm proud that we have yet again proven that we are still capable of working together to make amazing things happen. As someone who grew up in the 1970s, and someone who is proud to have worked at NASA for over 5 years, this is my American dream. Going Forward Curiosity is about to do amazing things and will tell a story to us that we'll never forget. Alas, NASA is a terribly easy target for politicians. It's budget has shrank to a small fraction of the it's early 1970s high, and it remains a target to this day. While the politicians congratulate the JPL … -
Django, websocket et bidouillage.
Lors du Django Meetup Paris numéro 2 (qui a eu lieu dans les locaux de 20 minutes, merci à eux pour le prêt de la salle (et à Julien pour l’orga) ), un petit récap des confs EuroDjango a été fait par Samuel (le frère de David, et oui un Paccoud peut en cacher un autre!!). Apparemment un des sujets porteur des EuroDjango avait été le ‘web temps réel’ (ce que je déteste ce terme tiens … temps réel, ça a un sens.. ça ne veut pas juste dire un truc en mode connecté) et la mise en place de celui ci dans Django (et du fait que peut être notre framework adoré n’était pas super en avance sur ce sujet). J’en ai profité pour donner mon avis sur la question. A savoir qu’à mon sens, les serveurs webs n’était pas fait du tout pour gérer des connexions en mode connecté. Parce qu’ils n’ont pas été prévu pour cela. Idem pour le cœur de django qui n’est pas fait pour garder des pools de sockets, des états par connexion clientes, etc etc … Alors qu’à contrario il y a des frameworks (je pense à twistted mais pas seulement) ou des … -
Deadline for DjangoCon Financial Aid requests is tomorrow!
For 2012, DjangoCon US has moved to Washington, DC, and everyone is invited! If you need financial support to get there, the Django Software Foundation and PyLadies have paired with a number of forward thinking sponsors to help get you there. All genders are eligible for assistance, so don't hesitate to submit your application. The deadline for financial aid requests is tomorrow, Friday, August 3rd by 11:59pm Eastern Time. Apply while you still have time! -
Deadline for DjangoCon Financial Aid requests is tomorrow!
For 2012, DjangoCon US has moved to Washington, DC, and everyone is invited! If you need financial support to get there, the Django Software Foundation and PyLadies have paired with a number of forward thinking sponsors to help get you there. All genders are eligible for assistance, so don't hesitate to submit your application. The deadline for financial aid requests is tomorrow, Friday, August 3rd by 11:59pm Eastern Time. Apply while you still have time! -
Shops near you – geographic features of GeoDjango
Boom on mobile devices and widespread Internet access created a demand for applications aware of user geographic location. Nowadays using modern web frameworks with magical powers you can make such geo-enabled web applications easily. Django offers a special sub-framework called geodjango. There you will find an enormous amount of features of "geographic" nature. In this article I'll present a simple application that will use a part of GeoDjango to search and display shops closest to given address. -
Deadline for DjangoCon Financial Aid requests is tomorrow!
For 2012, DjangoCon US has moved to Washington, DC, and everyone is invited! If you need financial support to get there, the Django Software Foundation and PyLadies have paired with a number of forward thinking sponsors to help get you there. All genders are eligible for assistance, so don't hesitate to submit your application. The deadline for financial aid requests is tomorrow, Friday, August 3rd by 11:59pm Eastern Time. Apply while you still have time!