How to password protect a machine gun hosted website

Is there a way to password protect an application hosted in gunicorn,

I did this with .htaccess in apache, but can we do this in gurnicorn?

+4
source share
2 answers

You marked django and it has some useful things built into it ...

You should be able to @login_required right in front of your specific function.

This will cause the current “anonymous” user to enter the login screen if they are not logged in.

+1
source

You can also use middleware and, for example, kill every session and not show anything if it does not meet the requirements. For example, you can define middleware that checks to see if a request comes from the IP address you are using, if so, do nothing, if not, stop it. Maybe not the best, but the solution :)

+1
source

Source: https://habr.com/ru/post/1384109/


All Articles