djangoforapis(1).pdf

(8856 KB) Pobierz
Django for APIs
Build web APIs with Python and Django
William S. Vincent
This book is for sale at
http://leanpub.com/djangoforapis
This version was published on 2019-10-28
This is a
Leanpub
book. Leanpub empowers authors and publishers with the Lean
Publishing process.
Lean Publishing
is the act of publishing an in-progress ebook
using lightweight tools and many iterations to get reader feedback, pivot until you
have the right book and build traction once you do.
© 2018 - 2019 William S. Vincent
Also By
William S. Vincent
Django for Beginners
Django for Professionals
Contents
Introduction
Prerequisites
Why APIs
Django REST Framework
Why this book
Conclusion
Chapter 1: Web APIs
World Wide Web
URLs
Internet Protocol Suite
HTTP Verbs
Endpoints
HTTP
Status Codes
Statelessness
REST
Conclusion
Chapter 2: Library Website and API
Traditional Django
First app
Models
1
1
2
3
4
5
6
6
7
8
9
10
11
13
14
15
15
17
17
21
23
CONTENTS
Admin
Views
URLs
Webpage
Django REST Framework
URLs
Views
Serializers
cURL
Browsable API
Conclusion
Chapter 3: Todo API
Initial Set Up
Models
Django REST Framework
URLs
Serializers
Views
Consuming the API
Browsable API
CORS
Tests
Conclusion
Chapter 4: Todo React Front-end
Install Node
Install React
Mock data
Django REST Framework + React
25
29
30
34
34
37
38
39
40
41
43
44
44
47
51
53
54
56
57
58
60
63
64
66
66
67
69
74
Zgłoś jeśli naruszono regulamin