问题
What are the key differences of these two libraries.In terms of usability, and features
If you already have a huge number of model classes, using flask-restLESS makes perfect sense, right?. What are the features it would lack, if it would done with flask-restful. Or, what are flask-restful gives you, that flask restless can't provide.?
回答1:
While I'm sure there's going to be a significant of overlap between Flask-RESTful and Flask-RESTless, here's the difference in orientation as far as I can tell:
Flask-RESTful aims to be generic, it's a "lightweight abstraction that works with your existing ORM/libraries". Your resources don't even have to be a model tied to a database, and it could be anything.
On the other hand, Flask-RESTless makes it clear that their best use case is "creating simple ReSTful JSON APIs from SQLAlchemy models"
So if you have a lot of SQLAlchemy models and need fairly standard REST API from those, you can use Flask-RESTless to speed up the development, you need minimal code to expose your models into the API.
If you have custom endpoints, or want to use models that aren't backed by SQLAlchemy you can create your own on Flask-RESTful
How to decide / or use both
You can do customize Flask-RESTless too (serialization, custom queries etc), with sufficient code you can use either frameworks.
To decide e.g. ask yourself do you have more structured model-based APIs or more custom APIs, that would save you the most development time and only deal with special cases when they arise.
And You can use both in a single Flask app, no problems there, you just e.g. map /api/resource-a/
to a Flask-RESTless API and /api/resource-b/
to another API from made with Flask-RESTful
来源:https://stackoverflow.com/questions/37783919/flask-restful-vs-flask-restless-which-should-be-used-and-when