This is a gotcha I ran across in some production code that is obvious in retrospect. I was profiling the code to find places where we were calling an_expensive_database_function and came across code like this:
def doit(*args, **kwargs): value = kwargs.get('key', an_expensive_database_function())
The original author probably assumed that …
I've been using Blosxom to power my dog agility blog for over 6 years. In the past year or so I've enabled Facebook comments in addition to my site's own comment plugin. I ran into a problem using Facebook's comments: if the user enters a comment on a page and …
Lately I've been interested in improving the interaction of my agilitycourses website for mobile users. One such improvement is to add QR Codes (aka 2D barcodes) representing the page URLs to the printed representations of pages served as PDFs.
I found that developers have reverse engineered the "api" of the …
I set up my development and deployment environments on Ubuntu with virtualenv with the --no-site-packages option to isolate them from packages in the system installation. My application uses pyrsvg and it is installed by default as a system package. Consequently I had to link the shared libraries it installs (w …
For the mobile version of agilitycourses.com I wanted to follow the approach Google appears to be using on some of its sites:
I'm adding an "m" subdomain to agilitycourses.com to provide a better mobile browsing experience. I'm using the referrer string in Django middleware (currently using minidetector) to detect whether the client is mobile and redirect them to the mobile site. Since it is likely that some folks will/won't get …
I couldn't find any documentation that covered all the pieces for configuring my latest Django site so I hope this helps someone else out.
I had used mod_wsgi under Apache for my other Django sites. But now I'm using different python versions for the sites (until if/when I update …
I've always preferred maintainable code over clever code:
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. - Brian W. Kernighan
Kernighan had it right all those …
Googility.com is my first Django website and under the covers the oldest code looked like it. I had originally written it with the sole intent of allowing people to enter dog agility businesses and websites into a database that I could use to create a Dog Agility Google Custom …
I use Haystack and the Python Whoosh project to provide search over ~3400 articles in my Googility.com database. I had originally implemented the search in the "simplest way that works". I was making some other enhancement to Googility and noticed the search result page had two undesirable behaviors: