-
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 rec...
-
'self' ForeignKeys always result in a JOIN
I came across a little annoyance in Django today. I found that a ForeignKey
that reference self, i.e. points to the same table, always results in a join
in a filter.
Take this normal foreign key reference.
class Customer(models.Models):
user...
-
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...
-
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...