If we want to create a simple
Player
model that we will use to represent and persist players in Django REST framework, we can create:A
Player
class as a subclass of thedjangorestframework.models.Model class
.A
Player
class as a subclass of thedjango.db.models.Model class
.A Player function in the
restframeworkmodels.py
file.
In the Django REST Framework, serializers are:
Mediators between the model instances and Python primitives.
Mediators between the view functions and Python primitives.
Mediators between the URLs and view functions.
In the Django REST Framework, parsers and renderers:
Handle as mediators between model instances and Python primitives.
Reset the board.
Handle as mediators between Python primitives and HTTP requests and responses.
The
urlpatterns
list declared in the urls.py file makes it possible to:Route URLs to views.
Route URLs to models.
Route URLs to Python primitives.
HTTPie is a:
Command-line HTTP server written in Python that makes it easy to create a RESTful Web Server.
Command-line utility that allows us to run queries against an SQLite database.
Command-line HTTP client written in Python that makes it easy to compose and send HTTP requests.
You're reading from Building RESTful Python Web Services
You have been reading a chapter from
Building RESTful Python Web ServicesPublished in: Oct 2016Publisher: PacktISBN-13: 9781786462251
© 2016 Packt Publishing Limited All Rights Reserved
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime