it seems Eventbrite has some pro Django peeps

Tonight I went to this Pycon practice talk at Eventbrite, and it was really great!   Simon Willison, who helped create Django at the Lawrence Journal-World gave a talk about feature flags and talked a bout things like flags for “maintenance mode” for a site, which is useful for having to make a site read-only.  One particularly interesting thing he noted about this was how you could create a custom auth middleware which basically ignored the user cookie.  And so, since this would make users not be able to login and modify data, your site could make progress towards being read only.   He also explicitly mentioned that the notion of “read only”-ness wasn’t at the SQL level, as you might think.  Instead, the preferred method was just to disable all possible ways of doing stuff!

Andrew Godwin, who I didn’t catch as “famous” at first but eventually realized as the creator of South gave a talk about API services and Eventbrite, and Lanyard’s migration from MySQL to Postgresql.

One cool thing I wrote down was this UserBasedExceptionMiddleware which could be used to show the debug page to a superuser even on production!

from django.views.debug import technical_500_response
import sys

class UserBasedExceptionMiddleware(object):
    def process_exception(self, request, exception):
        if request.user.is_superuser:
            return technical_500_response(request, *sys.exc_info())

Leave a Reply

Your email address will not be published. Required fields are marked *