Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named flask.ext.httpauth

I am trying to inistiate a Python server which uses the Flask framework. I'm having a hard time setting up the flask extention HTTPBasicAuth. I'm not sure how I can get this extension setup properly. Please help!

CMD output:

C:\Dev Workspaces\RestTutorial\REST-tutorial-master>python rest-server.py Traceback (most recent call last): File "rest-server.py", line 3, in from flask.ext.httpauth import HTTPBasicAuth File "C:\Python27\lib\site-packages\flask\exthook.py", line 87, in load_module

raise ImportError('No module named %s' % fullname) ImportError: No module named flask.ext.httpauth

Thanks!

like image 523
T Antonio Avatar asked Jul 24 '14 14:07

T Antonio


2 Answers

Probably too late to answer. But putting it here for others.

Only installing Flask will not install httpauth you have to install it explicitly. Run the following command to install globally:

$ pip install flask-httpauth

or

$ flask/bin/pip install flask-httpauth

where flask/bin is your virtual environment running flask

like image 197
Anirudha Agashe Avatar answered Oct 19 '22 22:10

Anirudha Agashe


Here you could find the reason.

In my case, the correct import for my flask version was the following one:

from flask_httpauth import HTTPBasicAuth
like image 33
Marc Servat Avatar answered Oct 19 '22 21:10

Marc Servat