Skip to content

Instantly share code, notes, and snippets.

@nicksnell
Created August 8, 2012 21:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicksnell/3298867 to your computer and use it in GitHub Desktop.
Save nicksnell/3298867 to your computer and use it in GitHub Desktop.
HTTP Auth for Django w/ Barrel
"""WSGI application file"""
import os
from django.core.wsgi import get_wsgi_application
from barrel import cooper
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
django_app = get_wsgi_application()
auth_decorator = cooper.basicauth(
users=[('someuser', 'somepass'),],
realm='Password Protected'
)
application = auth_decorator(django_app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment