دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش:
نویسندگان: Arghya Saha
سری:
ISBN (شابک) : 9781804610480
ناشر: packt Publishing Pvt Ltd
سال نشر: 2024
تعداد صفحات: 451
زبان: English
فرمت فایل : EPUB (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود)
حجم فایل: 2 Mb
در صورت تبدیل فایل کتاب Django in Production: Expert tips, strategies, and essential frameworks for writing scalable and maintainable code in Django به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب جنگو در تولید: نکات تخصصی، استراتژیها و چارچوبهای ضروری برای نوشتن کدهای مقیاسپذیر و قابل نگهداری در جنگو نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
Django in Production
Contributors
About the author
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Share Your Thoughts
Download a free PDF copy of this book
Part 1 – Using Django and DRF to Build Modern Web Application
Chapter 1: Setting Up Django with DRF
Technical requirements
Why Django?
What is available with Django?
What is the MVT framework?
Creating a “Hello World” web app with Django and DRF
Creating our Django hello_world project
Creating our first app in Django
Linking app views using urls.py
Integrating DRF
Creating RESTful API endpoints with DRF
Best practices for defining RESTful APIs
Best practices to create a REST API with DRF
Working with views using DRF
Functional views
Class-based views
Introducing API development tools
Summary
Chapter 2: Exploring Django ORM, Models, and Migrations
Technical requirements
Setting up PostgreSQL with a Django project
Creating a PostgreSQL server
Configuring Django with PostgreSQL
Using models and Django ORM
Adding Django models
Basic ORM concepts
How to get raw queries from ORM
Normalization using Django ORM
Exploring on_delete options
Using model inheritance
Understanding the crux of Django migrations
Demystifying migration management commands
Performing database migrations like a pro
Exploring best practices for working with models and ORM
Use base models
Use timezone.now() for any DateTime-related data
How to avoid circular dependency in models
Define __str__ for all models
Use custom model methods
Keep the default primary key
Use transactions
Avoid generic foreign keys
Use finite state machines (FSMs)
Break the model into packages
Learning about performance optimization
Demystifying performance using explain and analyze
Using index
Using Django ORM like a pro
Database connection configuration
Exploring Django Async ORM
Summary
Chapter 3: Serializing Data with DRF
Technical requirements
Understanding the basics of DRF Serializers
Using Model Serializers
Creating a new model object
Updating existing model Objects
Retrieving data from the Model object instance
Exploring the Meta class
Implementing Serializer relations
Working with nested Serializers
Exploring source
Exploring SerializerMethodField
Validating data with serializers
Customizing field-level validation
Defining a custom field-level validator
Performing object-level validation
Defining custom object-level validators
The order of the evaluation of validators
Remove default validators from the DRF Serializer class
Mastering DRF Serializers
Using source
Embracing SerializerMethodField
Using validators
Using to_internal_value
Using to_representation
Use a context argument to pass information
Customizing fields
Passing a custom QuerySet to PrimaryKeyField
Building DynamicFieldsSerializer
Avoiding the N+1 query problem
Using Serializers with DRF views
Working with generic views
Filtering with SearchFilter and OrderingFilter
Summary
Chapter 4: Exploring Django Admin and Management Commands
Technical requirements
Exploring Django Admin
Creating a superuser in Django
Understanding the Django Admin interface
Customizing Django Admin
Adding custom fields
Using filter_horizontal
Using get_queryset
Using third-party packages and themes
Using Django Admin logs
Optimizing Django Admin for production
Renaming admin URLs
Using two-factor authentication (2FA) for admin users
Using Custom Admin Paginator
Disabling ForeignKey drop-down options
Using list_select_related
Overriding get_queryset for performance
Adding django-json-widget
Using custom actions
Using permissions for Django Admin
Creating custom management commands
Summary
Chapter 5: Mastering Django Authentication and Authorization
Technical requirements
Learning the basics of Django authentication
Customizing the User model
Using a OneToOneField relationship with the User model
Using Django permissions and groups
Using permissions and groups in Django Admin
Creating custom permissions
Using Django permissions and groups for an API
Caveats of using permissions
Using DRF token-based authentication
Integrating token-based authentication into DRF
Adding DRF token-based authentication to a Django project
Understanding the limitations of token-based authentication of DRF
Learning about third-party token-based authentication packages
Integrating social login into Django and DRF
Summary
Part 2 – Using the Advanced Concepts of Django
Chapter 6: Caching, Logging, and Throttling
Technical requirements
Caching with Django
Using django-cacheops
Best practices for caching in production
Throttling with Django
Best practices for throttling in production
Logging with Django
Setting up logging
Best practices for logging in production
Summary
Chapter 7: Using Pagination, Django Signals, and Custom Middleware
Technical requirements
Paginating responses in Django and DRF
Understanding pagination
Using pagination in DRF
Demystifying Django signals
Creating custom signals
Working with signals in production
Working with Django middleware
Creating custom middleware
Summary
Chapter 8: Using Celery with Django
Technical requirements
Asynchronous programming in Django
Using Celery with Django
Integrating Celery and Django
Interfaces of Celery
Best practices for using Celery
Using celery beat with Django
Summary
Chapter 9: Writing Tests in Django
Technical requirements
Introducing the different types of tests in software development
Unit testing
Integration testing
E2E testing
Setting up tests for Django and DRF
Structuring and naming our test cases
Setting up a database for tests
Writing basic tests in DRF
Writing tests for advanced use cases
Using Django runners
Learning best practices to write tests
Using unit tests more often
Avoiding time bomb test failures
Avoiding brittle tests
Using a reverse function for URL path in tests
Using authentication tests
Using test tags to group tests
Using Postman to create an integration test suite
Creating different types of tests
Avoiding tests
Exploring Test-Driven Development
Summary
Chapter 10: Exploring Conventions in Django
Technical requirements
Code structuring for Django projects
Creating files as per functionalities
Avoiding circular dependencies
Creating a “common” app
Working with a settings file for production
Working with exceptions and errors
Using feature flags
Configuring Django for production
Setting up CORS
Exploring WSGI
Summary
Part 3 – Dockerizing and Setting Up a CI Pipeline for Django Application
Chapter 11: Dockerizing Django Applications
Technical requirements
Learning the basics of Docker
Installing Docker
Testing Docker on your local system
Important commands for Docker
Working with the requirements.txt file
Creating a Dockerfile for a Django project
Composing services using docker-compose.yaml
Creating a .env file
Accessing environment variables in Django
Starting a Django application using Docker
Summary
Chapter 12: Working with Git and CI Pipelines Using Django
Technical requirements
Using Git efficiently
Branching strategy for Git
Following good practices while using git commit
Tools with Git
Integrating Git hooks into a Django project
Using lefthook
Using git merge versus git rebase
Performing code release
Performing hot-fixing on code
Working with GitHub and GitHub Actions
Working with GitHub Actions for the CI pipeline
Setting up a CI pipeline for Django using GitHub Actions
Recommended GitHub Actions resources
Setting up code review guidelines
Context and description
Short code changes to review
Review when the code is ready
Good code reviewer
Summary
Part 4 – Deploying and Monitoring Django Applications in Production
Chapter 13: Deploying Django in AWS
Technical requirements
Learning the basics of AWS
Creating an account in AWS
Identity and Access Management
EC2
Elastic Load Balancer (ELB)
Elastic Beanstalk
RDS for Postgres
ElastiCache for Redis
Security groups and network components
AWS Secrets Manager
Route 53
The AWS Billing console
CloudWatch
Integrating AWS Elastic Beanstalk to deploy Django
Integrating Beanstalk with a basic Django app
Deploying a Django application using GitHub Actions in Elastic Beanstalk
Following the best practices for the AWS infrastructure
Best practices for RDS
Best practices for ElastiCache
Best practices for Elastic Beanstalk
Best practices for IAM and security
Summary
Chapter 14: Monitoring Django Application
Technical requirements
Integrating error monitoring tools
Integrating Rollbar into a Django project
Integrating Rollbar with Slack
Best practices while working with error monitoring tools
Integrating uptime monitoring
Adding a health check endpoint
Using BetterStack for uptime monitoring
Integrating APM tools
Integrating New Relic into the Django project
Exploring the New Relic dashboard
Creating New Relic alert conditions
Monitoring AWS EC2 instances with New Relic
Sending logs from Django to New Relic
Working with metrics and events using NRQL
Integrating messaging tools using Slack
Handling production incidents better
Blameless RCA for incidents
Summary
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book