You should use [`override_settings`](https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.utils.override_settings).