Django REST framework
Last updated
Was this helpful?
Last updated
Was this helpful?
The source repository is
Installation
pip install djangorestframework
In the regular django, you need to implement view in order to output data.
with REST framework, only need to implement serializer book.serializers.py
in order to save data.
And, register url in
book.urls.py
When server startup, then you can view api in
Snake-case to camel-case Python is a language like all against c syntax, no curly brace block match and use snake-case for the variables. In general, we also use camel-case in javascript, json. The following implementation totally take the extra translation.
Add
This parser was copied from .
So in the settings.py, also update:
To bypass cross Origin, you need to add the following middleware implementation into order to have browser accept the cross site permission. Middleware implement at bookstore_api.corsapp.middleware.py