舉報

會員
Django Design Patterns and Best Practices
Thisbookisforyouwhetheryou’renewtoDjangoorjustwanttolearnitsbestpractices.YoudonothavetobeanexpertinDjangoorPython.Nopriorknowledgeofpatternsisexpectedforreadingthisbookbutitwouldbehelpful.
最新章節
- Leave a review - let other readers know what you think
- Other Books You May Enjoy
- Further information
- Other changes
- Pyvenv and pip are built in
- New goodies
品牌:中圖公司
上架時間:2021-06-25 20:49:09
出版社:Packt Publishing
本書數字版權由中圖公司提供,并由其授權上海閱文信息技術有限公司制作發行
- Leave a review - let other readers know what you think 更新時間:2021-06-25 21:32:49
- Other Books You May Enjoy
- Further information
- Other changes
- Pyvenv and pip are built in
- New goodies
- Standard library reorganized
- Exception syntax changes and improvements
- f-strings or formatted string literals
- HttpRequest and HttpResponse have str and bytes types
- Relative imports must be explicit
- Calling super() is easier
- All classes inherit from object
- Change all __unicode__ methods into __str__
- Python 3 for Djangonauts
- Python 3
- Python 2 Versus Python 3
- Summary
- Caching patterns
- Caching frameworks
- Cached session backend
- Caching
- Database
- Templates
- Backend performance
- Frontend performance
- Improving Performance
- Monitoring
- Configuration management
- Typical deployment steps
- Fabric
- Deployment tools
- Other hosting approaches
- Serverless
- Virtual private servers
- Platform as a service
- Hosting
- Microservices
- Virtual machines or Docker
- Components of a stack
- Choosing a web stack
- The production environment
- Production-Ready
- Summary
- A handy security checklist
- And the web attacks are unending
- How Django helps
- Shell injection
- How Django helps
- Clickjacking
- Where Django might not help
- How Django helps
- SQL injection
- Where Django might not help
- How Django helps
- Cross-site request forgery
- Where Django might not help
- How Django helps
- Why are your cookies valuable?
- Cross-site scripting
- Security
- Summary
- Debugging Django templates
- Other debuggers
- The Python debugger pdb
- The Django Debug Toolbar
- Logging
- The print function
- A better debug page
- Django debug page
- Debugging
- Learning more about testing
- Solution details
- Problem details
- Pattern – Test fixtures and factories
- Mocking
- Writing better test cases
- The assert method
- Writing a test case
- TDD
- Why write tests?
- Testing and Debugging
- Summary
- Future proofing
- Legacy database integration
- Step-by-step process to writing tests
- Writing tests before making any changes
- Incremental change or a full rewrite?
- PyGraphviz installation and usage
- Creating the big picture
- Understanding the code base
- Jumping around the code
- Starting with urls.py
- Where are the files? This is not PHP
- Activating the virtual environment
- Finding the Django Version
- Dealing with Legacy Code
- Summary
- Solution details
- Problem details
- Pattern – Infinite Scrolling
- Solution details
- Problem details
- Pattern – human browsable interface
- API patterns
- Hiding the IDs
- Improving the Public Posts API
- Django Rest framework
- Versioning
- API design
- RESTful API
- Creating APIs
- Summary
- Differences from Celery
- Listening to notifications with WebSockets
- Entering Channels
- Concurrency is not parallelism
- Asynchronous web-scraping
- Synchronous web-scraping
- The classic web-scraper example
- asyncio versus threads
- Understanding asyncio
- Avoid passing complex objects to tasks
- Database updates without race conditions
- Avoid writing to shared or global state
- Idempotent tasks
- Handling failure
- Celery best practices
- How Celery works
- Working with Celery
- Asynchronous solutions for Django
- Polling pattern
- Publish-subscribe pattern
- Endpoint callback pattern
- Asynchronous patterns
- Pitfalls of asynchronous code
- Why asynchronous?
- Working Asynchronously
- Summary
- Solution details
- Problem details
- Pattern – CRUD views
- Same view for separate actions
- Separate views for separate actions
- Solution details
- Problem details
- Pattern – multiple form actions per view
- Solution details
- Problem details
- Pattern – user-based forms
- Solution details
- Problem details
- Pattern – dynamic form generation
- Form patterns
- Form processing with class-based views
- Understanding CSRF
- Time to be crisp
- Displaying forms
- Why does data need cleaning?
- Forms in Django
- How forms work
- Forms
- Summary
- Solution details
- Problem details
- Pattern – feature flags
- Protecting the admin
- Complete overhauls
- Bootstrap-themed admin
- Adding a rich-text editor for WYSIWYG editing
- Changing the base and stylesheets
- Changing the heading
- Admin interface customizations
- Not everyone should be an admin
- Enhancing models for the admin
- Using the admin interface
- Admin Interface
- Summary
- Custom tags
- A template-only solution
- Solution details
- Problem details
- Pattern — the active link
- Solution details
- Problem details
- Pattern — template inheritance tree
- Template patterns
- Lightweight alternatives
- But they all look the same!
- Using Bootstrap
- How templates work
- Organizing templates
- Jinja2
- Philosophy – don't invent a programming language
- Tags
- Filters
- Attributes
- Variables
- Understanding Django's template language features
- Templates
- Summary
- React.js Vue.js and other view replacements
- RESTful URLs
- Department store URLs
- URL pattern styles
- Pattern order
- Names and namespaces
- Can the simplified syntax replace regular expressions?
- Regular expression URL pattern syntax
- Simplified URL pattern syntax
- What happens in urls.py?
- URL anatomy
- Designing URLs
- Solution details
- Problem details
- Pattern – services
- Solution details
- Problem details
- Pattern — context enhancers
- Solution details
- Problem details
- Pattern — access controlled views
- View patterns
- Decorators
- Order of mixins
- View mixins
- Class-Based Views are not always Class-Based Generic Views
- Class-based generic views
- Views got classier
- A view from the top
- Views and URLs
- Summary
- Migrations
- Chaining multiple QuerySets
- Set operations on QuerySets
- Solution details
- Problem details
- Pattern — custom model managers
- Cached properties
- Solution details
- Problem details
- Pattern — property field
- Retrieval patterns
- Solution details
- Problem details
- Pattern – service objects
- Multiple profile types
- Admin
- Signals
- Solution details
- Problem details
- Pattern — user profiles
- Model mixins
- Solution details
- Problem details
- Pattern — model mixins
- Should we always normalize?
- Performance and denormalization
- Django models
- Third normal form (3NF)
- Second normal form (2NF)
- First normal form (1NF)
- Three steps of normalization
- Solution details
- Problem details
- Patterns — normalized models
- Structural patterns
- Splitting models.py into multiple files
- The model hunt
- M is bigger than V and C
- Models
- Summary
- Starting the project
- Which Django Version to use
- Why Python 3?
- SuperBook – your mission should you choose to accept it
- Best practices before starting a project
- Which packages made it?
- My app sandbox
- Reuse or roll-your-own?
- Dividing a project into apps
- Designing the application
- HTML mockups
- Are you a storyteller?
- How to gather requirements?
- Application Design
- Summary
- Python Zen and Django's design philosophy
- How to use patterns
- Criticism of patterns
- Patterns in this book
- Are there more patterns?
- Fowler's patterns
- Is Django MVC?
- Gang of four patterns
- What is a pattern?
- How does Django work?
- Django keeps getting better
- Removing the magic
- A framework is born
- The story of Django
- Why Django?
- Django and Patterns
- Reviews
- Get in touch
- Conventions used
- Download the color images
- Download the example code files
- To get the most out of this book
- What this book covers
- Who this book is for
- Preface
- Packt is searching for authors like you
- About the reviewer
- About the author
- Contributors
- PacktPub.com
- Why subscribe?
- PacktPub.com
- 版權信息
- 封面
- 封面
- 版權信息
- 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