Vivekananda T
Vivekananda T

Reputation: 63

how to password protect a website hosted on gunicorn

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

Answers (2)

g19fanatic
g19fanatic

Reputation: 10961

You tagged 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

Ignas Butėnas
Ignas Butėnas

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

Related Questions