Set Apache to prompt a password for a Django site?

I have a Django wsgi site that I would put online soon. I would rather the site to not be accessible except through an Apache login prompt until it is ready.

I investigated and found limited or outdated information about how to do it (which I tried anyway).

There is more information to make it work with a plain Apache served webpage and I was able to made it work on my default Apache welcome page, but Django seems less documented in that regard.

For example I added something like this in my .conf file:

    <Directory "/path/to/djangosite">
        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>

where /path/to/djangosite is where wsgi.py resides. Password was set in .htpasswd successfully.

How are you all doing this?

Back to Top