舉報

會員
Django Design Patterns and Best Practices
Thisbookisforyouwhetheryou’renewtoDjangoorjustwanttolearnitsbestpractices.YoudonothavetobeanexpertinDjangoorPython.Nopriorknowledgeofpatternsisexpectedforreadingthisbookbutitwouldbehelpful.
目錄(321章)
倒序
- 封面
- 版權信息
- PacktPub.com
- Why subscribe?
- PacktPub.com
- Contributors
- About the author
- About the reviewer
- Packt is searching for authors like you
- Preface
- Who this book is for
- What this book covers
- To get the most out of this book
- Download the example code files
- Download the color images
- Conventions used
- Get in touch
- Reviews
- Django and Patterns
- Why Django?
- The story of Django
- A framework is born
- Removing the magic
- Django keeps getting better
- How does Django work?
- What is a pattern?
- Gang of four patterns
- Is Django MVC?
- Fowler's patterns
- Are there more patterns?
- Patterns in this book
- Criticism of patterns
- How to use patterns
- Python Zen and Django's design philosophy
- Summary
- Application Design
- How to gather requirements?
- Are you a storyteller?
- HTML mockups
- Designing the application
- Dividing a project into apps
- Reuse or roll-your-own?
- My app sandbox
- Which packages made it?
- Best practices before starting a project
- SuperBook – your mission should you choose to accept it
- Why Python 3?
- Which Django Version to use
- Starting the project
- Summary
- Models
- M is bigger than V and C
- The model hunt
- Splitting models.py into multiple files
- Structural patterns
- Patterns — normalized models
- Problem details
- Solution details
- Three steps of normalization
- First normal form (1NF)
- Second normal form (2NF)
- Third normal form (3NF)
- Django models
- Performance and denormalization
- Should we always normalize?
- Pattern — model mixins
- Problem details
- Solution details
- Model mixins
- Pattern — user profiles
- Problem details
- Solution details
- Signals
- Admin
- Multiple profile types
- Pattern – service objects
- Problem details
- Solution details
- Retrieval patterns
- Pattern — property field
- Problem details
- Solution details
- Cached properties
- Pattern — custom model managers
- Problem details
- Solution details
- Set operations on QuerySets
- Chaining multiple QuerySets
- Migrations
- Summary
- Views and URLs
- A view from the top
- Views got classier
- Class-based generic views
- Class-Based Views are not always Class-Based Generic Views
- View mixins
- Order of mixins
- Decorators
- View patterns
- Pattern — access controlled views
- Problem details
- Solution details
- Pattern — context enhancers
- Problem details
- Solution details
- Pattern – services
- Problem details
- Solution details
- Designing URLs
- URL anatomy
- What happens in urls.py?
- Simplified URL pattern syntax
- Regular expression URL pattern syntax
- Can the simplified syntax replace regular expressions?
- Names and namespaces
- Pattern order
- URL pattern styles
- Department store URLs
- RESTful URLs
- React.js Vue.js and other view replacements
- Summary
- Templates
- Understanding Django's template language features
- Variables
- Attributes
- Filters
- Tags
- Philosophy – don't invent a programming language
- Jinja2
- Organizing templates
- How templates work
- Using Bootstrap
- But they all look the same!
- Lightweight alternatives
- Template patterns
- Pattern — template inheritance tree
- Problem details
- Solution details
- Pattern — the active link
- Problem details
- Solution details
- A template-only solution
- Custom tags
- Summary
- Admin Interface
- Using the admin interface
- Enhancing models for the admin
- Not everyone should be an admin
- Admin interface customizations
- Changing the heading
- Changing the base and stylesheets
- Adding a rich-text editor for WYSIWYG editing
- Bootstrap-themed admin
- Complete overhauls
- Protecting the admin
- Pattern – feature flags
- Problem details
- Solution details
- Summary
- Forms
- How forms work
- Forms in Django
- Why does data need cleaning?
- Displaying forms
- Time to be crisp
- Understanding CSRF
- Form processing with class-based views
- Form patterns
- Pattern – dynamic form generation
- Problem details
- Solution details
- Pattern – user-based forms
- Problem details
- Solution details
- Pattern – multiple form actions per view
- Problem details
- Solution details
- Separate views for separate actions
- Same view for separate actions
- Pattern – CRUD views
- Problem details
- Solution details
- Summary
- Working Asynchronously
- Why asynchronous?
- Pitfalls of asynchronous code
- Asynchronous patterns
- Endpoint callback pattern
- Publish-subscribe pattern
- Polling pattern
- Asynchronous solutions for Django
- Working with Celery
- How Celery works
- Celery best practices
- Handling failure
- Idempotent tasks
- Avoid writing to shared or global state
- Database updates without race conditions
- Avoid passing complex objects to tasks
- Understanding asyncio
- asyncio versus threads
- The classic web-scraper example
- Synchronous web-scraping
- Asynchronous web-scraping
- Concurrency is not parallelism
- Entering Channels
- Listening to notifications with WebSockets
- Differences from Celery
- Summary
- Creating APIs
- RESTful API
- API design
- Versioning
- Django Rest framework
- Improving the Public Posts API
- Hiding the IDs
- API patterns
- Pattern – human browsable interface
- Problem details
- Solution details
- Pattern – Infinite Scrolling
- Problem details
- Solution details
- Summary
- Dealing with Legacy Code
- Finding the Django Version
- Activating the virtual environment
- Where are the files? This is not PHP
- Starting with urls.py
- Jumping around the code
- Understanding the code base
- Creating the big picture
- PyGraphviz installation and usage
- Incremental change or a full rewrite?
- Writing tests before making any changes
- Step-by-step process to writing tests
- Legacy database integration
- Future proofing
- Summary
- Testing and Debugging
- Why write tests?
- TDD
- Writing a test case
- The assert method
- Writing better test cases
- Mocking
- Pattern – Test fixtures and factories
- Problem details
- Solution details
- Learning more about testing
- Debugging
- Django debug page
- A better debug page
- The print function
- Logging
- The Django Debug Toolbar
- The Python debugger pdb
- Other debuggers
- Debugging Django templates
- Summary
- Security
- Cross-site scripting
- Why are your cookies valuable?
- How Django helps
- Where Django might not help
- Cross-site request forgery
- How Django helps
- Where Django might not help
- SQL injection
- How Django helps
- Where Django might not help
- Clickjacking
- How Django helps
- Shell injection
- How Django helps
- And the web attacks are unending
- A handy security checklist
- Summary
- Production-Ready
- The production environment
- Choosing a web stack
- Components of a stack
- Virtual machines or Docker
- Microservices
- Hosting
- Platform as a service
- Virtual private servers
- Serverless
- Other hosting approaches
- Deployment tools
- Fabric
- Typical deployment steps
- Configuration management
- Monitoring
- Improving Performance
- Frontend performance
- Backend performance
- Templates
- Database
- Caching
- Cached session backend
- Caching frameworks
- Caching patterns
- Summary
- Python 2 Versus Python 3
- Python 3
- Python 3 for Djangonauts
- Change all __unicode__ methods into __str__
- All classes inherit from object
- Calling super() is easier
- Relative imports must be explicit
- HttpRequest and HttpResponse have str and bytes types
- f-strings or formatted string literals
- Exception syntax changes and improvements
- Standard library reorganized
- New goodies
- Pyvenv and pip are built in
- Other changes
- Further information
- Other Books You May Enjoy
- Leave a review - let other readers know what you think 更新時間:2021-06-25 21:32:49
推薦閱讀
- 玩轉Scratch少兒趣味編程
- Computer Vision for the Web
- Neo4j Essentials
- Scratch 3.0少兒編程與邏輯思維訓練
- 零基礎學MQL:基于EA的自動化交易編程
- C語言實驗指導及習題解析
- Android Native Development Kit Cookbook
- Elasticsearch Server(Third Edition)
- Unity 2D Game Development Cookbook
- Building Microservices with .NET Core
- Python函數式編程(第2版)
- Learning VMware vSphere
- Machine Learning for Developers
- Scrapy網絡爬蟲實戰
- Greenplum構建實時數據倉庫實踐
- Google Adsense優化實戰
- Web開發新體驗
- 走近SDN/NFV
- Real-time Analytics with Storm and Cassandra
- PHP程序員面試算法寶典
- Web應用程序開發技術
- 我的第一堂編程課:孩子和家長都需要的編程思維
- Applied Unsupervised Learning with Python
- Unsupervised Learning with R
- OpenCV計算機視覺編程攻略(第3版)
- Troubleshooting Citrix XenDesktop?
- Nginx底層設計與源碼分析
- Go語言從入門到精通
- Delphi Cookbook(Second Edition)
- 滾雪球學Python