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

RONNIE WONG
PLUS
RONNIE WONG
Courses Plus Student 3,322 Points

from flask.ext.restful import Resource seem can not find ,deprecated?

I import from flask.ext.restful import Resource at pycharm today it is not working well, I am running python 2.7 with Flask==0.10.1 Flask-API==0.6.9 Flask-Cors==2.1.2 Flask-RESTful==0.3.5

I read a post from https://github.com/eisen-dev/eisen_engine/issues/35, it mention the flask.ext.restful import Resource

Should I use from flask-restful import Resource?

4 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Yeah, Flask recently had a big shift where they recommended people use from package_name import resource instead of from flask.ext.package import resource. I liked the latter method better, honestly, 'cause it felt more formal. But, regardless of that, that shift came after all of the courses were recorded, so they're now "wrong".

I remember dealing with something like this long time ago. I just checked the official docs, here: https://flask-restful.readthedocs.io/en/0.3.5/quickstart.html, and they are doing:

from flask_restful import Resource

Check it out and let me know.

-Dan

RONNIE WONG
PLUS
RONNIE WONG
Courses Plus Student 3,322 Points

Okay, good then because if follow the tutorial and as well downloaded project.zip it still refer to "flask.ext.restful import Resource"

Right, probably that is because when Kenneth Love recorded this, flask.ext.restful was still in use. You know, something I've learned with time is that we, software developer, need to quickly adapt to changes, and this a great example of those moments. This is part of the field. Good luck and happy coding!