Index ¦ Archives ¦ Atom

Avoiding cached datetimes with Django querysets

In Django we often need to filter out objects from a queryset which shouldn't be visible to public users, a typical example of this would be a news post in a blog. A staff user could edit a news post to have a publish date in the future, allowing it …


RUNLEVEL=1 apt-get install package alternative

An old documented way of preventing services from starting immediately after installation in Debian/Ubuntu is using the RUNLEVEL environment variable to trick the runlevel helper into returning a response that the system isn't fully running, such as:

# RUNLEVEL=1 apt-get install nginx

Sadly this doesn't work in newer versions …


Fixing GDAL and GEOS for Django on macOS

As a user of MacPorts for all the additional packages needed when working with Django on macOS, a recent upgrade to GEOS managed to break all my projects which used GeoDjango:

$ ./manage.py help
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)

  ...

  File …

The cost of Dirty Fields

After installing Django Dirty Fields on projects a few months ago and seeing a dramatic reduction in the number of writes to our main Postgres database - everything seemed fine. However on a brand new project, something wasn't quite right performance wise:

$ siege --concurrent=1 --reps=10 "http://127.0.0 …

Modern Django with Ubuntu Trusty

At this point Ubuntu 14.04 Trusty Tahr is nearly 2.5 years old, with another 2.5 years support left until it reaches end of life for support. However for those of us still working with Trusty, it's often desirable to try and get a few backported modern packages …

© Alex Tomkins.