ImportError: No module named flask.ext.httpauth

T Antonio picture T Antonio · Jul 24, 2014 · Viewed 17.1k times · Source

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!

Answer

Anirudha Agashe picture Anirudha Agashe · Dec 28, 2014

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