-
posts
-
Kubernetes Health Checks in Django
In a previous post I wrote about Kubernetes health checks. Since I’m a Python developer and a fan, I went about implementing it in Django. Health checks are a great way to help Kubernetes help your app to have high availability, and that include...
-
Testing Django Views Without Using the Test Client
The normal way to test Django views is via the test client. The test client fakes being a wsgi server and actually makes an HTTP request through all of Django’s request routing machinery. There are a number of reasons why this isn’t an ideal appro...
-
Administer WordPress using Django's Admin
I recently came across one feature of Django that seemed pretty useful
for one off projects and customizations and was startled because it’s
one of Django’s least mentioned features. In fact, I’ve been using
Django at work for over 5 years now and...
-
Django's contrib.auth and django-newauth
Recently there have been a lot of conversations on the Django mailing
list about fixing the auth module. Here are some of the recent mailing
list threads:
authentication by
email
auth.User refactor:
reboot
auth.User: The abstract base clas...
-
bpssl - The Django SSL Support Application
The other day I released bpssl which is a Django application that helps
you support HTTPS on your website. The main functionality is performing
redirection for HTTPS only URLs and views. For instance, if a request
for your login view ‘/login’ is r...
-
'self' ForeignKeys always result in a JOIN
I came across a little annoyance in Django today. I found that
ForeignKeys that reference ‘self’, i.e. they point to the same table,
always result in a join in a filter.
Take this normal foreign key reference.
class Customer(models.Models):
...
-
Django template2pdf
This is cool Django application from Yasushi
Masuda which allows you to render data to
a pdf using trml2pdf.
template2pdf provides a
generic view called direct_to_pdf which will render a rml template
directly to pdf.
# coding: utf-8
from django...
-
Running django with daemontools
Running django fastcgi with daemontools is rather easy but getting it to
run in the foreground with the proper user takes a bit of knowledge
about how bash works and the tools in daemontools.
In order to run the fastcgi daemon in the foreground y...
-
Testing HTTPS with Django's Development Server
Django’s development server doesn’t normally support HTTPS so it’s hard
to test applications with HTTPS without deploying the application to a
real web server that supports HTTPS. The secret is to use two
development server instances, one for http...
-
Minimum cost for warming-up various frameworks(and more)
My good friend Takashi Matsuo
wrote an interesting blog about start up times of various frameworks on
appengine. Because appengine kills your server process it often needs to
load your application into memory from scratch. This can take a lot of
t...
-
Testing using a mocked HTTP server
Recently I got some tests working for my
django-lifestream
project. The lifestream imports data from RSS/Atom feeds so there isn’t
a good way to run tests without creating a test HTTP server to serve up
your RSS/Atom.
The tests start up an http s...
-
Annoying things about Django
Since I’ve been using it for a while now I’ve gotten a good idea about
what is good and what is annoying about development with django. This
might seem a little trite at parts since some of these gripes are with
features that don’t exist in other ...
-
Custom Admin Views and Reversing Django Admin URLs
I recently used the new feature in Django 1.1 for reversing django
admin
urls
and specifying custom admin
views
in my project
django-lifestream.
django-lifestream has a custom admin
view
which allows users to update the lifestream manually. The c...
-
Django and nginx settings
One problem I keep encountering with setting up fastcgi with Django is
that the default nginx fastcgi parameters cause django to load the top
url no matter what url you try to go to. This is because the default
nginx fastcgi parameters pass the SC...
-
Google Appengine SDK 1.2.3
The Google Appengine
SDK 1.2.3
was just released and contains some often asked for goodies such as
Django 1.0 support and support for a task queue
API.
I haven’t found much information about the Django 1.0 version in
Appengine but here are some l...
-
Preview blog posts within the django admin.
I
implemented
blog post previews for my blog using the technique described here:
http://latherrinserepeat.org/2008/7/28/stupid-simple-django-admin-previews/
It’s very simple as it is simply a view using an existing record. I’d
prefer something th...
-
New Django-based Homepage
I finally got around to finishing up my
Django based website. It’s pretty
inexcusable for a Django developer to have a PHP based blog website. I’m
happy that it seems to be snappier and I haven’t don’t anything
particular to try to make it fast so...
-
Werkzeug and reverse urls
I wanted to impove a Google Appengine application that a friend of mine created (ほぼ汎用イベント管理ツール(jp)) and noticed that he was redirecting directly to urls. He is using Werkzeug to handle url routing so I wondered if there was a method for generating...
-
QueryDict and update()
Yesterday I ran into an interesting quirk with Django's QueryDict object and the normal dictionary update() method. Normally the update method will allow you to merge two dictionary or dictionary like objects but because the QueryDict internally h...
-
Field/column Queries in Django
One of the neat things making it's way into Django 1.1 is F object queries. The F object is kind of like the Q object as it can be used it queries but it represents a database field on the right hand side of an equality/inequality.
For the exampl...
-
Django Sitemap Framework
Using the Django sitemap framework is so easy it's almost no work at all. Just make a sitemap object and add it to the sitemap in urls.py. The sitemap framework calls items() in your Sitemap to get the list of objects to put in the sitemap and the...
-
Django admin inline forms
For my new project dlife (Update: Now django-lifestream), I went about implementing a simple comments interface that would allow users to make comments on imported feed items. I wanted to support this in the admin in the typical manner such that w...
-
Python Onsen Oct. 2008
Last weekend I went to my second Python Onsen[jp] organized by Nakai-san(id:voluntas). I talked about Python Onsen in my first blog post here. Python Onsen is a 3 day event (Fri, Sat, Sun) but as before I only participated on Saturday and Sunday. ...
-
Django
I was thinking about using Django for one of my projects on GAE because it seems like a popular project and somewhat easy to use, but I'm not quite understanding yet why it's better to have helper functions rather than controller/handler classes l...