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

Python Build a Social Network with Flask Making Strong Users The UserMixin From Flask-Login

Chris Schultz
seal-mask
.a{fill-rule:evenodd;}techdegree
Chris Schultz
Python Web Development Techdegree Student 19,775 Points

import 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

I 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.

Thanks! For me, flask.ext.login failed but flask_login worked. I was scratching my head for about half an hour before finding this post :)

Anthony Attard
Anthony Attard
43,915 Points

Thanks for bringing this up. I actually prefer the new method as it is much more clear on what is being imported.

Bryan Dobberstein
Bryan Dobberstein
16,361 Points

This class is a little dated. So far the Python offerings here haven't been impressive.