دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش: [5 ed.]
نویسندگان: Antonio Melé
سری:
ISBN (شابک) : 9781805125457
ناشر: Packt Publishing
سال نشر: 2024
تعداد صفحات: 1028
زبان: English
فرمت فایل : EPUB (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود)
حجم فایل: 45 Mb
در صورت تبدیل فایل کتاب Django 5 By Example: Build powerful and reliable Python web applications from scratch 5th Edition به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب Django 5 By Example: ساخت برنامه های تحت وب قدرتمند و قابل اعتماد پایتون از ابتدا نسخه پنجم نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
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 Join us on Discord! Visit the book’s dedicated website Head to https://djangobyexample.com/ to find out more about the book and what past readers thought about it. Share your thoughts Download a free PDF copy of this book Building a Blog Application Installing Python Creating a Python virtual environment Installing Django Installing Django with pip Django overview Main framework components The Django architecture New features in Django 5 Creating your first project Applying initial database migrations Running the development server Project settings Projects and applications Creating an application Creating the blog data models Creating the Post model Adding datetime fields Defining a default sort order Adding a database index Activating the application Adding a status field Adding a many-to-one relationship Creating and applying migrations Creating an administration site for models Creating a superuser The Django administration site Adding models to the administration site Customizing how models are displayed Adding facet counts to filters Working with QuerySets and managers Creating objects Updating objects Retrieving objects Filtering objects Using field lookups Chaining filters Excluding objects Ordering objects Limiting QuerySets Counting objects Checking if an object exists Deleting objects Complex lookups with Q objects When QuerySets are evaluated More on QuerySets Creating model managers Building list and detail views Creating list and detail views Using the get_object_or_404 shortcut Adding URL patterns for your views Creating templates for your views Creating a base template Creating the post list template Accessing our application Creating the post detail template The request/response cycle Management commands used in this chapter Summary Additional resources Join us on Discord! Enhancing Your Blog and Adding Social Features Functional overview Using canonical URLs for models Creating SEO-friendly URLs for posts Modifying the URL patterns Modifying the views Modifying the canonical URL for posts Adding pagination Adding pagination to the post list view Creating a pagination template Handling pagination errors Building class-based views Why use class-based views Using a class-based view to list posts Recommending posts by email Creating forms with Django Handling forms in views Sending emails with Django Working with environment variables Sending emails in views Rendering forms in templates Creating a comment system Creating a model for comments Adding comments to the administration site Creating forms from models Handling ModelForms in views Creating templates for the comment form Adding comments to the post detail view Adding comments to the post detail template Using simplified templates for form rendering Summary Additional resources Extending Your Blog Application Functional overview Implementing tagging with django-taggit Retrieving posts by similarity Creating custom template tags and filters Implementing custom template tags Creating a simple template tag Creating an inclusion template tag Creating a template tag that returns a QuerySet Implementing custom template filters Creating a template filter to support Markdown syntax Adding a sitemap to the site Creating feeds for blog posts Adding full-text search to the blog Installing Docker Installing PostgreSQL Dumping the existing data Switching the database in the project Loading the data into the new database Simple search lookups Searching against multiple fields Building a search view Stemming and ranking results Stemming and removing stop words in different languages Weighting queries Searching with trigram similarity Summary Expanding your project using AI Additional resources Building a Social Website Functional overview Creating a social website project Starting the social website project Using the Django authentication framework Creating a login view Using Django’s built-in authentication views Login and logout views Change password views Reset password views User registration and user profiles User registration Extending the user model Installing Pillow and serving media files Creating migrations for the profile model Using a custom user model Summary Additional resources Join us on Discord! Implementing Social Authentication Functional overview Technical requirements Using the messages framework Building a custom authentication backend Preventing users from using an existing email address Adding social authentication to your site Running the development server through HTTPS Authentication using Google Creating a profile for users that register with social authentication Summary Additional resources Sharing Content on Your Website Functional overview Creating an image bookmarking website Building the image model Creating many-to-many relationships Registering the image model in the administration site Posting content from other websites Cleaning form fields Installing the Requests library Overriding the save() method of a ModelForm Building a bookmarklet with JavaScript Creating a detail view for images Creating image thumbnails using easy-thumbnails Adding asynchronous actions with JavaScript Loading JavaScript on the DOM Cross-site request forgery for HTTP requests in JavaScript Performing HTTP requests with JavaScript Adding infinite scroll pagination to the image list Summary Additional resources Tracking User Actions Functional overview Building a follow system Creating many-to-many relationships with an intermediate model Creating list and detail views for user profiles Adding user follow/unfollow actions with JavaScript Creating an activity stream application Using the contenttypes framework Adding generic relations to your models Avoiding duplicate actions in the activity stream Adding user actions to the activity stream Displaying the activity stream Optimizing QuerySets that involve related objects Using select_related() Using prefetch_related() Creating templates for actions Using signals for denormalizing counts Working with signals Application configuration classes Using Django Debug Toolbar Installing Django Debug Toolbar Django Debug Toolbar panels Django Debug Toolbar commands Counting image views with Redis Installing Redis Using Redis with Python Storing image views in Redis Storing a ranking in Redis Next steps with Redis Summary Expanding your project using AI Additional resources Building an Online Shop Functional overview Creating an online shop project Creating product catalog models Registering catalog models on the administration site Building catalog views Creating catalog templates Building a shopping cart Using Django sessions Session settings Session expiration Storing shopping carts in sessions Creating shopping cart views Adding items to the cart Building a template to display the cart Adding products to the cart Updating product quantities in the cart Creating a context processor for the current cart Context processors Setting the cart in the request context Registering customer orders Creating order models Including order models in the administration site Creating customer orders Creating asynchronous tasks Working with asynchronous tasks Workers, message queues, and message brokers Using Django with Celery and RabbitMQ Monitoring Celery with Flower Summary Additional resources Join us on Discord! Managing Payments and Orders Functional overview Integrating a payment gateway Creating a Stripe account Installing the Stripe Python library Adding Stripe to your project Building the payment process Integrating Stripe Checkout Testing the checkout process Using test credit cards Checking the payment information in the Stripe dashboard Using webhooks to receive payment notifications Creating a webhook endpoint Testing webhook notifications Referencing Stripe payments in orders Going live Exporting orders to CSV files Adding custom actions to the administration site Extending the administration site with custom views Generating PDF invoices dynamically Installing WeasyPrint Creating a PDF template Rendering PDF files Sending PDF files by email Summary Additional resources Extending Your Shop Functional overview Creating a coupon system Building the coupon model Applying a coupon to the shopping cart Applying coupons to orders Creating coupons for Stripe Checkout Adding coupons to orders on the administration site and to PDF invoices Building a recommendation engine Recommending products based on previous purchases Summary Additional resources Adding Internationalization to Your Shop Functional overview Internationalization with Django Internationalization and localization settings Internationalization management commands Installing the gettext toolkit How to add translations to a Django project How Django determines the current language Preparing your project for internationalization Translating Python code Standard translations Lazy translations Translations including variables Plural forms in translations Translating your own code Translating templates The {% translate %} template tag The {% blocktranslate %} template tag Translating the shop templates Using the Rosetta translation interface Fuzzy translations URL patterns for internationalization Adding a language prefix to URL patterns Translating URL patterns Allowing users to switch language Translating models with django-parler Installing django-parler Translating model fields Integrating translations into the administration site Creating migrations for model translations Using translations in QuerySets Adapting views for translations Format localization Using django-localflavor to validate form fields Expanding your project using AI Summary Additional resources Building an E-Learning Platform Functional overview Setting up the e-learning project Serving media files Building the course models Registering the models in the administration site Using fixtures to provide initial data for models Creating models for polymorphic content Using model inheritance Abstract models Multi-table model inheritance Proxy models Creating the Content models Creating custom model fields Adding ordering to Module and Content objects Adding authentication views Adding an authentication system Creating the authentication templates Summary Additional resources Join us on Discord! Creating a Content Management System Functional overview Creating a CMS Creating class-based views Using mixins for class-based views Working with groups and permissions Restricting access to class-based views Managing course modules and their contents Using formsets for course modules Adding content to course modules Managing modules and their contents Reordering modules and their contents Using mixins from django-braces Summary Additional resources Rendering and Caching Content Functional overview Displaying the catalog of courses Adding student registration Creating a student registration view Enrolling in courses Rendering course contents Accessing course contents Rendering different types of content Using the cache framework Available cache backends Installing Memcached Installing the Memcached Docker image Installing the Memcached Python binding Django cache settings Adding Memcached to your project Cache levels Using the low-level cache API Checking cache requests with Django Debug Toolbar Low-level caching based on dynamic data Caching template fragments Caching views Using the per-site cache Using the Redis cache backend Monitoring Redis with Django Redisboard Summary Additional resources Building an API Functional overview Building a RESTful API Installing Django REST framework Defining serializers Understanding parsers and renderers Building list and detail views Consuming the API Extending serializers Adding additional fields to serializers Implementing serializer method fields Adding pagination to views Building the course serializer Serializing relations Creating nested serializers Creating ViewSets and routers Building custom API views Handling authentication Implementing basic authentication Adding permissions to views Adding additional actions to ViewSets Creating custom permissions Serializing course contents Consuming the RESTful API Summary Additional resources Building a Chat Server Functional overview Creating a chat application Implementing the chat room view Real-time Django with Channels Asynchronous applications using ASGI The request/response cycle using Channels Installing Channels and Daphne Writing a consumer Routing Implementing the WebSocket client Enabling a channel layer Channels and groups Setting up a channel layer with Redis Updating the consumer to broadcast messages Adding context to the messages Modifying the consumer to be fully asynchronous Persisting messages into the database Creating a model for chat messages Adding the message model to the administration site Storing messages in the database Displaying the chat history Integrating the chat application with existing views Summary Additional resources Going Live Creating a production environment Managing settings for multiple environments Local environment settings Running the local environment Production environment settings Using Docker Compose Installing Docker Compose via Docker Desktop Creating a Dockerfile Adding the Python requirements Creating a Docker Compose file Configuring the PostgreSQL service Applying database migrations and creating a superuser Configuring the Redis service Serving Django through WSGI and NGINX Using uWSGI Configuring uWSGI Using NGINX Configuring NGINX Using a hostname Serving static and media assets Collecting static files Serving static files with NGINX Securing your site with SSL/TLS Checking your project for production Configuring your Django project for SSL/TLS Creating an SSL/TLS certificate Configuring NGINX to use SSL/TLS Redirecting HTTP traffic over to HTTPS Configuring Daphne for Django Channels Using secure connections for WebSockets Including Daphne in the NGINX configuration Creating a custom middleware Creating subdomain middleware Serving multiple subdomains with NGINX Implementing custom management commands Summary Expanding your project using AI Additional resources Join us on Discord! Other Books You May Enjoy Index