Why do Django views need an as_view() method?

One thing I’ve sometimes wondered about when using Django: Why do view objects need to be constructed in a special way? For those of you who haven’t used Django, a typical URL mapping scheme looks like this: urlpatterns = [ url(r’^login/$’, views.LoginView.as_view(), name=’login’), url(r’^logout/$’, views.LogoutView.as_view(), name=’logout’), # … ] This maps URLs to view classes […]

Smarter debug logging with q

I stumbled across an interesting looking library completely by chance the other day. It has the impossible-to-Google name of q, so I guess other people might have overlooked it as well. The idea is to deal with those cases that aren’t supposed to happen, but happen anyway: you’re working on a bug and want to […]