在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例Clojure → Django 3 By Example Build powerful and reliable Python web applications from scratch, 3rd Edition (Antonio Mele [Melé, Antonio])

Django 3 By Example Build powerful and reliable Python web applications from scratch, 3rd Edition (Antonio Mele [Melé, Antonio])

Clojure

下载此实例
  • 开发语言:Others
  • 实例大小:9.07M
  • 下载次数:5
  • 浏览次数:50
  • 发布时间:2022-07-24
  • 实例类别:Clojure
  • 发 布 人:hybflying
  • 文件格式:.pdf
  • 所需积分:2

实例介绍

【实例简介】Django 3 By Example Build powerful and reliable Python web applications from scratch, 3rd Edition (Antonio Mele [Melé, Antonio]) 

Preface
Django is a powerful Python web framework that encourages rapid development
and clean, pragmatic design, while offering a relatively shallow learning curve.
This makes it attractive to both novice and expert programmers.
This book will guide you through the entire process of developing professional web
applications with Django. The book not only covers the most relevant aspects of the
framework, but it will also teach you how to integrate other popular technologies
into your Django projects.
The book will walk you through the creation of real-world applications, solving
common problems, and implementing best practices, using a step-by-step approach
that is easy to follow.
After reading this book, you will have a good understanding of how Django works
and how to build practical, advanced web applications.
Who this book is for
This book is intended for developers with Python knowledge who wish to learn
Django in a pragmatic way. Perhaps you are completely new to Django, or you
already know a little but you want to get the most out of it. This book will help you
to master the most relevant areas of the framework by building practical projects
from scratch. You need to have familiarity with programming concepts in order
to read this book. Some previous knowledge of HTML and JavaScript is assumed


【实例截图】

from clipboard


【核心代码】

Table of Contents
Preface
xi
Chapter 1: Building a Blog Application
1
Installing Django
2
Creating an isolated Python environment
3
Installing Django with pip
3
Creating your first project
4
Running the development server
6
Project settings
8
Projects and applications
9
Creating an application
10
Designing the blog data schema
10
Activating the application
13
Creating and applying migrations
13
Creating an administration site for models
15
Creating a superuser
15
The Django administration site
16
Adding models to the administration site
17
Customizing the way that models are displayed
19
Working with QuerySets and managers
21
Creating objects
21
Updating objects
23
Retrieving objects
23
Using the filter() method
23
Using exclude()
24
Using order_by()
24
Deleting objects
24
When QuerySets are evaluated
25Table of Contents
[ ii ]
Creating model managers
25
Building list and detail views
26
Creating list and detail views
26
Adding URL patterns for your views
28
Canonical URLs for models
29
Creating templates for your views
30
Adding pagination
34
Using class-based views
36
Summary
38
Chapter 2: Enhancing Your Blog with Advanced Features
39
Sharing posts by email
40
Creating forms with Django
40
Handling forms in views
41
Sending emails with Django
43
Rendering forms in templates
45
Creating a comment system
50
Building a model
50
Creating forms from models
52
Handling ModelForms in views
53
Adding comments to the post detail template
54
Adding the tagging functionality
58
Retrieving posts by similarity
64
Summary
66
Chapter 3: Extending Your Blog Application
67
Creating custom template tags and filters
68
Custom template tags
68
Custom template filters
73
Adding a sitemap to your site
76
Creating feeds for your blog posts
80
Adding full-text search to your blog
82
Installing PostgreSQL
83
Simple search lookups
84
Searching against multiple fields
84
Building a search view
85
Stemming and ranking results
88
Weighting queries
89
Searching with trigram similarity
90
Other full-text search engines
91
Summary
91Table of Contents
[ iii ]
Chapter 4: Building a Social Website
93
Creating a social website project
94
Starting your social website project
94
Using the Django authentication framework
95
Creating a login view
96
Using Django authentication views
101
Login and logout views
102
Changing password views
108
Resetting password views
110
User registration and user profiles
115
User registration
115
Extending the user model
119
Using a custom user model
125
Using the messages framework
125
Building a custom authentication backend
128
Adding social authentication to your site
130
Running the development server through HTTPS
132
Authentication using Facebook
134
Authentication using Twitter
140
Authentication using Google
142
Summary
147
Chapter 5: Sharing Content on Your Website
149
Creating an image bookmarking website
150
Building the image model
150
Creating many-to-many relationships
152
Registering the image model in the administration site
153
Posting content from other websites
153
Cleaning form fields
154
Overriding the save() method of a ModelForm
155
Building a bookmarklet with jQuery
160
Creating a detail view for images
168
Creating image thumbnails using easy-thumbnails
170
Adding AJAX actions with jQuery
172
Loading jQuery
173
Cross-site request forgery in AJAX requests
174
Performing AJAX requests with jQuery
176
Creating custom decorators for your views
179
Adding AJAX pagination to your list views
181
Summary
186Table of Contents
[ iv ]
Chapter 6: Tracking User Actions
187
Building a follow system
187
Creating many-to-many relationships with an intermediary model
188
Creating list and detail views for user profiles
191
Building an AJAX view to follow users
196
Building a generic activity stream application
198
Using the contenttypes framework
200
Adding generic relations to your models
201
Avoiding duplicate actions in the activity stream
204
Adding user actions to the activity stream
205
Displaying the activity stream
206
Optimizing QuerySets that involve related objects
207
Using select_related()
207
Using prefetch_related()
208
Creating templates for actions
208
Using signals for denormalizing counts
210
Working with signals
211
Application configuration classes
213
Using Redis for storing item views
215
Installing Redis
215
Using Redis with Python
217
Storing item views in Redis
218
Storing a ranking in Redis
220
Next steps with Redis
223
Summary
223
Chapter 7: Building an Online Shop
225
Creating an online shop project
226
Creating product catalog models
227
Registering catalog models on the administration site
229
Building catalog views
230
Creating catalog templates
233
Building a shopping cart
237
Using Django sessions
238
Session settings
239
Session expiration
240
Storing shopping carts in sessions
240
Creating shopping cart views
245
Adding items to the cart
245
Building a template to display the cart
247
Adding products to the cart
249
Updating product quantities in the cart
251Table of Contents
[ v ]
Creating a context processor for the current cart
252
Context processors
252
Setting the cart into the request context
253
Registering customer orders
255
Creating order models
255
Including order models in the administration site
257
Creating customer orders
258
Launching asynchronous tasks with Celery
263
Installing Celery
263
Installing RabbitMQ
264
Adding Celery to your project
264
Adding asynchronous tasks to your application
265
Monitoring Celery
267
Summary
268
Chapter 8: Managing Payments and Orders
269
Integrating a payment gateway
269
Creating a Braintree sandbox account
270
Installing the Braintree Python module
271
Integrating the payment gateway
272
Integrating Braintree using Hosted Fields
274
Testing payments
280
Going live
283
Exporting orders to CSV files
284
Adding custom actions to the administration site
284
Extending the administration site with custom views
287
Generating PDF invoices dynamically
292
Installing WeasyPrint
292
Creating a PDF template
292
Rendering PDF files
294
Sending PDF files by email
297
Summary
300
Chapter 9: Extending Your Shop
301
Creating a coupon system
301
Building the coupon model
302
Applying a coupon to the shopping cart
304
Applying coupons to orders
312
Adding internationalization and localization
314
Internationalization with Django
315
Internationalization and localization settings
315
Internationalization management commands
316
How to add translations to a Django project
316Table of Contents
[ vi ]
How Django determines the current language
316
Preparing your project for internationalization
317
Translating Python code
318
Standard translations
319
Lazy translations
319
Translations including variables
319
Plural forms in translations
319
Translating your own code
320
Translating templates
324
The {% trans %} template tag
324
The {% blocktrans %} template tag
324
Translating the shop templates
325
Using the Rosetta translation interface
328
Fuzzy translations
331
URL patterns for internationalization
332
Adding a language prefix to URL patterns
332
Translating URL patterns
333
Allowing users to switch language
334
Translating models with django-parler
336
Installing django-parler
336
Translating model fields
337
Integrating translations into the administration site
339
Creating migrations for model translations
340
Adapting views for translations
341
Format localization
344
Using django-localflavor to validate form fields
345
Building a recommendation engine
347
Recommending products based on previous purchases
347
Summary
356
Chapter 10: Building an E-Learning Platform
357
Setting up the e-learning project
358
Building the course models
359
Registering the models in the administration site
361
Using fixtures to provide initial data for models
362
Creating models for diverse content
365
Using model inheritance
366
Abstract models
366
Multi-table model inheritance
367
Proxy models
367
Creating the content models
368
Creating custom model fields
370
Adding ordering to module and content objects
372
Creating a CMS
377
Adding an authentication system
377Table of Contents
[ vii ]
Creating the authentication templates
378
Creating class-based views
381
Using mixins for class-based views
381
Working with groups and permissions
383
Restricting access to class-based views
385
Managing course modules and their contents
391
Using formsets for course modules
391
Adding content to course modules
396
Managing modules and their contents
402
Reordering modules and their contents
407
Using mixins from django-braces
407
Summary
411
Chapter 11: Rendering and Caching Content
413
Displaying courses
414
Adding student registration
419
Creating a student registration view
419
Enrolling on courses
422
Accessing the course contents
425
Rendering different types of content
429
Using the cache framework
432
Available cache backends
432
Installing Memcached
433
Cache settings
434
Adding Memcached to your project
434
Monitoring Memcached
435
Cache levels
436
Using the low-level cache API
436
Caching based on dynamic data
438
Caching template fragments
440
Caching views
441
Using the per-site cache
441
Summary
442
Chapter 12: Building an API
443
Building a RESTful API
444
Installing Django REST framework
444
Defining serializers
445
Understanding parsers and renderers
446
Building list and detail views
447
Creating nested serializers
450
Building custom API views
452
Handling authentication
453Table of Contents
[ viii ]
Adding permissions to views
454
Creating viewsets and routers
456
Adding additional actions to viewsets
457
Creating custom permissions
458
Serializing course contents
459
Consuming the REST API 
461
Summary
465
Chapter 13: Building a Chat Server
467
Creating a chat application
467
Implementing the chat room view
468
Deactivating the per-site cache
471
Real-time Django with Channels
471
Asynchronous applications using ASGI
471
The request/response cycle using Channels
472
Installing Channels
473
Writing a consumer
476
Routing
477
Implementing the WebSocket client
478
Enabling a channel layer
484
Channels and groups
484
Setting up a channel layer with Redis
484
Updating the consumer to broadcast messages
486
Adding context to the messages
490
Modifying the consumer to be fully asynchronous
494
Integrating the chat with existing views
495
Summary
496
Chapter 14: Going Live
497
Creating a production environment
497
Managing settings for multiple environments
498
Using PostgreSQL
500
Checking your project
501
Serving Django through WSGI
501
Installing uWSGI
502
Configuring uWSGI
502
Installing NGINX
505
The production environment
506
Configuring NGINX
506
Serving static and media assets
509
Securing connections with SSL/TLS
511
Creating an SSL/TLS certificate
511Table of Contents
[ ix ]
Configuring NGINX to use SSL/TLS
512
Configuring your Django project for SSL/TLS
514
Redirecting HTTP traffic over to HTTPS
515
Using Daphne for Django Channels
516
Using secure connections for WebSockets
517
Including Daphne in the NGINX configuration
518
Creating a custom middleware
520
Creating a subdomain middleware
522
Serving multiple subdomains with NGINX
523
Implementing custom management commands
524
Summary
527
Other Books You May Enjoy
529
Index
533


实例下载地址

Django 3 By Example Build powerful and reliable Python web applications from scratch, 3rd Edition (Antonio Mele [Melé, Antonio])

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警