XOR Media

Coding, Operations, Etc.

Keeping Track with Graphite and Statsd

I recently gave a presentation on graphite and statsd to the East Bay Django meetup It's more about the importance of stats in general when running services, web or otherwise. The slides are available and embedded here. There's also a related demo project that turned out to be ...

(more)
In ops, tagged: django, performance, python, and stats.

Django ALLOWED_HOSTS and Amazon Elastic Load Balancer

A recent Django security release added a new configuration option, ALLOWED_HOSTS. It's optional in 1.3 and 1.4, but required in 1.5 setups. The relevant detail is that when enabled in production Django will throw 500 errors if the Host header doesn't match one of the ...

(more)
In ops, tagged: aws, django, elb, and python.

Django Model Validation On Save

In what is probably my biggest WTF with Django to date, it doesn't validate your models before saving them to the database. All of the necessary code exists and when a dev sets up her models she usually adds the relevant validations using EmailField, URLField, blank, null, unique, ..., but ...

(more)

Django Startup Signal

If you've spent some time with Django chances are you've run across its signals system. It is most commonly used to provide hooks in to the model setup and CRUD processes, but there are many other uses of the facility throughout the code including auth, db, and the ...

(more)
In code, tagged: django, signals, and python.

Python Django render_with_template Decorator

Python decorators are extremely useful when used with care, and using them is really straightforward. Coding them up on the other hand can be complex and requires, reading along with trial-and-error. There are some helpful modules out there worth taking a look at, but for this use-case we won't ...

(more)
In code, tagged: django, decorator, and python.