I am using django-lockdown for this purpose. This allows you to add a simple password to the entire dev site without adding extra authorization bits to your views that are not used outside of the dev environment. It also means that you can log in as an administrator or regular users to check what your site is doing.
https://github.com/Dunedan/django-lockdown
I use Heroku and Lockdown with this bit of code in my settings.py file
USE_LOCKDOWN = os.environ.get('USE_LOCKDOWN', 'False') == 'True' if USE_LOCKDOWN: INSTALLED_APPS += ('lockdown',) MIDDLEWARE_CLASSES += ('lockdown.middleware.LockdownMiddleware',) LOCKDOWN_PASSWORDS = (os.environ.get('LOCKDOWN_PASSWORD', 'False'),) LOCKDOWN_URL_EXCEPTIONS = (r'^/some/url/not/locked/down/$',)
Then, obviously, set config var of USE_LOCKDOWN as True on my site-dev, and False on my production site, so no need to change the code for.
source share