Blog Category: django

Django logging in version 1.4: How to correctly remove the require_debug_false filter from the mail_admin handler

1/3/2013

There you are, configuring some shiny new django website of yours, and you want to test some of the logging features. And because you're testing in a development environment, you have DEBUG=True in your settings.py file. But the problem is, you're not seeing the admin logging emails you are expecting. So, you check the LOGGING variable in settings.py to see if you missed something. It looks something like this by default: ...

User-friendly Django CSRF Protection

1/3/2013

The fact that Django comes with CSRF protection is extremely nice. Unless, of course, your hobby is exploiting websites, in which case get off my site. For the rest of us, thwart those baddies by using Django's CsrfViewMiddleware and the csrf_token tag. But when you do, keep in mind what that changes on your webpages. The csrf_token tag sets a cookie. So, that begs the question: ...