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 trialChris Schultz
Python Web Development Techdegree Student 19,775 Pointsimport syntax, flask.ext.module vs flask_module
I understand that importing with the "ext" syntax is now depreciated in flask. http://flask.pocoo.org/docs/0.10/extensiondev/#ext-import-transition
The code:
from flask.ext.login import UserMixin
Would be:
from flask_login import UserMixin
Any thoughts?
4 Answers
rtkacddqbo
9,662 PointsI know this is an old question, but just incase anyone is following along at home on PyCharm, I kept getting and error when I gave the import as it's written in the video, and when I changed it to from flask_login import UserMixin it worked just fine.
Anthony Attard
43,915 PointsThanks for bringing this up. I actually prefer the new method as it is much more clear on what is being imported.
Bryan Dobberstein
16,361 PointsThis class is a little dated. So far the Python offerings here haven't been impressive.
Richard A
Courses Plus Student 10,121 PointsThanks for this posting Chris! Appreciate it!
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsThanks! For me,
flask.ext.login
failed butflask_login
worked. I was scratching my head for about half an hour before finding this post :)