Schof
Schof

Reputation: 6579

Password-Protect a development or staging Django app

I'm using the solution in Password protect a whole django app

I found that in order to be able to see a password entry form, I had to add a LOCKDOWN_FORM setting. Without that, I'd see the "This is not yet available to the public." message, with no place to enter a password. So my Lockdown stanza looks like this:

INSTALLED_APPS += ('lockdown',)
MIDDLEWARE_CLASSES += ('lockdown.middleware.LockdownMiddleware',)
LOCKDOWN_PASSWORDS = ('password', )
LOCKDOWN_URL_EXCEPTIONS = (r'^/admin',)
LOCKDOWN_FORM = 'lockdown.forms.LockdownForm'

However, I can't log in. When I enter "password" in the login field, it tells me the password is incorrect.

What am I doing wrong?

Upvotes: 3

Views: 696

Answers (1)

Schof
Schof

Reputation: 6579

So, turns out the documentation is for the development version of django-lockdown, which has not been released to PyPI. (Boo!)

I found the answer here: https://bitbucket.org/carljm/django-lockdown/issue/1/new-pypi-release

Turns out it should be LOCKDOWN_PASSWORD, singular, not plural, and it should not be a tuple. Working stanza:

INSTALLED_APPS += ('lockdown',)
MIDDLEWARE_CLASSES += ('lockdown.middleware.LockdownMiddleware',)
LOCKDOWN_PASSWORD = 'password'
LOCKDOWN_URL_EXCEPTIONS = (r'^/admin',)
LOCKDOWN_FORM = 'lockdown.forms.LockdownForm'

Upvotes: 5

Related Questions