Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
hum4n01d
25,493 PointsFlask-bcrypt deprecation error?
Hi everyone,
I’m following the "Build a Social Network with Flask" course and am currently adding crypt to the app but I’m getting this error when I use it:
from flask.ext.bcrypt import generate_password_hash
>>> venv/lib/python3.5/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.bcrypt is deprecated, use flask_bcrypt instead.
.format(x=modname), ExtDeprecationWarning
Does anybody know what I should do?
Thanks!
hum4n01d
25,493 PointsOk thanks. If you could make your response an answer I’ll mark it as best
1 Answer
martinhenoch
3,340 PointsHi,
from flask.ext.foo import bar
is the old way of importing stuff from flask extensions, and...
from flask_foo import bar
...is the new and recommended way (where "foo" and "bar" is placeholder names for extension and class/function/<...>). The old notation "flask.ext.foo" should work in most cases, but it is deprecated which means it's discouraged and eventually will lose support.
See the flask documentation: http://flask.pocoo.org/docs/0.11/extensiondev/#ext-import-transition
to answer your question, write instead:
from flask_bcrypt import generate_password_hash
Good luck!
hum4n01d
25,493 PointsThanks!
martinhenoch
3,340 Pointsmartinhenoch
3,340 PointsEdit: I made my comment into an answer instead.
Still new to this :)