-1

My google search leads me to these articles 01 02

With 01 I don't know how to use it; recieving error

ImportError: No module named flask.ext.htpasswd

With 02, it seems to be incomplete.

So how can we protect website with .htaccess password similarly the way we do with PHP website?

davidism
  • 121,510
  • 29
  • 395
  • 339
Nam G VU
  • 33,193
  • 69
  • 233
  • 372

1 Answers1

2

Both those solutions are perfectly correct. For the first, as has already been established, you need to install the flask-htpasswd extension first:

pip install flask-htpasswd

For the second, you'll need to show your implementation. But basically, the method requires you to create a custom decorator which asks for the authentication. You can extend it further by storing a logged in user's credentials inside the sessions.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • Though I cannot get it work on AWS EB; it works on AWS EC2. Details as another question here http://stackoverflow.com/q/39031017/248616 – Nam G VU Aug 19 '16 at 04:17