Reputation: 63
Is there a way to password protect an application which is hosted in gunicorn,
I did this with .htaccess in apache, but can we do this in gurnicorn?
Upvotes: 4
Views: 4682
Reputation: 10961
You tagged django and it has some useful things built right into it...
You should be able to do a @login_required right before your specific view funciton.
This will force the current 'anonymous' user to a login screen if they aren't logged in.
Upvotes: 1
Reputation: 6317
You can also use middleware and for example kill every session and show nothing if it not passes the requirements. For example, you can define middleware which checks if the request comes from the IP you use, if yes - do nothing, if no - stop. Maybe not the best, but solution :)
Upvotes: 1