T Antonio
T Antonio

Reputation: 191

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!

Upvotes: 19

Views: 21456

Answers (4)

Marc Servat
Marc Servat

Reputation: 41

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

Upvotes: 4

yussan
yussan

Reputation: 2327

Importing flask.ext.httpauth is deprecated, use flask_httpauth instead. do you have try this one.

Upvotes: 3

Anirudha Agashe
Anirudha Agashe

Reputation: 3530

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

Upvotes: 32

WaydeHall
WaydeHall

Reputation: 153

Did you install and set up the module properly? Go to http://flask.pocoo.org/docs/quickstart/ where you will find a quick start guide for the flask framework.

Upvotes: 1

Related Questions