Django Shrink The Web django-stw 1.0 Released

It has been several years since I've worked on my Django driven website that uses Shrink The Web (STW) screen shots. During that time STW has simplified their feature set and their API.

As I upgraded my site (Googility.com) I took some time to modernize the django-stw template tag …

Pelican For Fast Site/Project Development

I was working on a simple single page website for calculating dog agility jump heights and was really missing the tool chain I normally use in Flask and Django web sites for bundling, compressing, and versioning CSS and JS files and a mechanism for putting the bundled/versioned file names …

LiveReload with Pelican

I was looking to use LiveReload while developing using Pelican and I came across this nice simple solution by Merlijn van Deen.

In my use case I also wanted to watch the pelicanconf.py file and themes directory for changes and then regenerate the output and reload the browser. Lastly …

Tagged as: python webdev pelican

Upgrading Pelican and Migrating to GitHub Pages

I've been using Pelican for this blog for almost three years with source and output stored in a GitHub repository. The output files were then checked out and hosted as static content behind an NGINX web server on my VPS. Since I set that up GitHub introduced GitHub Pages with …

Tagged as: pelican github python

Django Migrating Models from an Abstract Base Class to a Concrete Base Class

On my agilitycourses.com I had been modeling three types of dog agility courses using an abstract base class Course with three child classes: Box, StarBox, and DoubleBox. This created three tables in the database prepended with the Django application name box: box_box, box_starbox, and box_doublebox. I needed to add …

Django REST Registration with django-rest-auth and django-allauth

I'm creating a mobile app for my agilitycourses website and I'm using django-rest-framework to provide a REST API for use by the client application. In order to provide authentication and registration I'm using django-allauth. Lastly I use django-rest-auth to provide REST resources for authentication and registration.

I implemented and tested …

Integrated Coverage Analysis with Coveralls

When I converted django-periodicals to use cookiecutter-djangopackage I was running coverage.py in my Travis-CI .travis.yml to report the coverage results to the command line log. The coverage results were interesting but didn't really alter my development practice much.

Over the years I've had differing options about coverage testing …

cookiecutter-djangopackage - Do the Right Thing

In preparation for upgrading and enhancing Googility.com I've started breaking out reusable applications, upgrading them, and open sourcing the code on GitHub. I wanted to follow development best practices and create high quality applications including these features:

  • A full set of tests.
  • Near 100% code coverage.
  • Continuous Integration running …

My Favorite ORM and Python Anti-Patterns

At work I was looking at improving the performance of one of our slower web pages. It can be rewarding to find a little piece of code that can be easily optimized. This time there were several functions that were adding 10+ sec to the page in worst case. It …

Python dict.get's Default Value is Always Evaluated

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 …

Tagged as: python