Django 6 and Python 3 book + with Vue 3, Bootstrap 5 and Alpine.js - From Scratch

Video thumbnail

Django is a framework with many options, it allows us to create applications with the language of the moment Python, a modular programming language, with an impeccable syntax that we can also use in a web environment.

It offers us a modular scheme between projects and applications, an important set of packages to extend the already complete framework and with this, the creation of scalable projects.

 

 

Foreword

Django is a framework with many options, it allows us to create applications with the language of the moment Python, a modular programming language, with an impeccable syntax that we can also use in a web environment.

It offers us a modular scheme between projects and applications, an important set of packages to extend the already complete framework and with this, the creation of scalable projects.

It is a framework that, by using Python, brings us its benefits of a clean, clear, precise syntax, a modular and scalable environment through packages.

In this book, we are going to learn how the framework is formed, the basic characteristics that Django allows us as the framework par excellence to create CRUDs processes, which range from the creation of views, templates, connection to models, routing, form validations, creating middleware among others.

In short, you will have an enormous material at your disposal, to make true web applications.
 

Who is this book for

This book is for anyone who wants to start developing with Django; you may come from another framework or even PHP; in both cases, it is a great idea to learn from one of the most advanced and complete web frameworks you can find.

  • For those who want to know the framework and who know other web frameworks, but do not have the necessary knowledge to venture into these.
  • For people who want to improve a skill in web development, who want to grow as a developer and who want to keep climbing their way with other frameworks similar to this one.
  • For those who want to learn or improve a skill and with this, increase their chances of employment or to carry out a personal project.

 

 

 

 

 

 

 

Topics of the book

This book has a total of 20 chapters, it is recommended that you read in the order in which they are arranged and as we explain the components of the framework, go directly to the practice, replicate, test and modify the codes that we show in this book.

  1. Chapter 1: In this chapter we are going to present the software necessary to create projects in Django, Python as a programming language and in which the framework is developed, a code editor such as VSS, until preparing the environment.
  2. Chapter 2: In this chapter we are going to create the virtual environment to develop the application, we will create the project in Django, we will learn about its basic structure and the use of applications and projects in Django.
  3. Chapter 3: In this chapter we will give an introduction to Python, knowing its basic characteristics and functionalities such as variables, data types, functions, classes, among others.
  4. Chapter 4: In this chapter, we are going to create a simple CRUD type application and learn about all the elements of the framework that this implies such as management of forms, templates, views and models, in addition to the management of CSRF tokens, migrations, databases among others.
  5. Chapter 5: In this chapter, we are going to work with Django Admin to provide an interface for managing site content; that is, the typical CRUDs, we will learn how to customize them at the class level, validations, interpret requests, among others.
  6. Chapter 6: In this chapter, we are going to introduce the use of forms in Django, definition, validations, saving and structure in general.
  7. Chapter 7: In this chapter, we are going to present the different functionalities that templates have in Django.
  8. Chapter 8: In this chapter, we are going to introduce some functions that we can use with QuerySets when building queries.
  9. Chapter 9: In this chapter, we are going to build a Rest API with the Django Rest Framework.
  10. Chapter 10: In this chapter, we are going to consume the above Rest Api with an app in Vue 3 and NaiveUI; lists, forms will be created and integrated with Tailwind.css
  11. Chapter 11 : In this chapter, we are going to learn about class-based views by performing the typical operations that are needed in modern web development.
  12. Chapter 12: In this chapter, we are going to learn how to work with files in Django; specifically reading and generating excel and CSV and generating PDFs.
  13. Chapter 13:  In this chapter, we are going to adapt the Alpine.js application presented in the previous chapter, so that it works together with Django.
  14. Chapter 14: Django Channels, In this chapter, we'll use Django Channels to learn how to create full-duplex communication systems and build and consume our own WebSockets. We'll see how to create single-channel and multi-channel applications, as well as how to consume a consumer from a Vue app.
  15. Chapter 15: Custom Authentication, In this chapter, we'll create a custom authentication module with login, registration, password recovery, email sending, avatar upload, and more.
  16. Chapter 16: Signals, In this chapter, we'll learn how to use the Signals system to intercept events in Django, such as the creation of entities in the database, and execute custom code.
  17. Chapter 17: Introduction to Testing, In this chapter, we'll introduce the use of testing to create automated functions and test different modules of our application.
  18. Chapter 18: Deployment, We'll see how to deploy the project to the Railway and PythonAnywhere services.
  19. Chapter 20: Integrating PayPal, We will create a small online store integrating PayPal with Django, and we will learn the entire integration process.

It is a framework that, by using Python, brings us its benefits of a clean, clear, precise syntax, a modular and scalable environment through packages.

In this book, we are going to learn how the framework is formed, the basic characteristics that Django allows us as the framework par excellence to create CRUDs processes, which range from the creation of views, templates, connection to models, routing, form validations, creating middleware among others.

In short, you will have an enormous material at your disposal, to make true web applications.

What will you learn in this Django Book?

  • Essential Fundamentals of Django and Python
    • We start with the essentials: virtual environment, correct installation, project structure, and the famous MVT pattern.
  • MVT: models, views, and templates without complications
    • You'll learn to connect every piece of the framework to build complete applications with clarity.
  • ORM, migrations, and relationships between models
    • Django ORM is wonderful when you understand how it works. You'll see one-to-many, many-to-many, and one-to-one relationships, plus advanced queries with custom managers.
  • Django Admin: the jewel that accelerates your development
    • Here comes my personal experience: since I first used Django Admin, I understood why Django is a global reference. I'll teach you how to customize it to turn it into a professional tool.
  • Forms, validations, and authentication
    • Class-based forms, manual forms, validations, login/logout, user registration, and permissions.
  • REST APIs with Django Rest Framework
    • We will create a complete and fully functional REST API, including token authentication.
  • Professional Deployments: AWS, environments, and security
    • You'll learn how to take your projects to production with AWS, best practices, secure environments, and optimized configuration.

 

Prologue

Django is a framework with many options; it allows us to create applications with the language of the moment, Python, a modular programming language with impeccable syntax that we can also use in a web environment.

It offers a modular scheme between project and applications, an important set of packages to extend the already complete framework, and with this, the creation of scalable projects.

It's a framework that, by using Python, brings with it the benefits of clean, clear, precise syntax, a modular environment, and scalability through packages.

In this Book, we will learn how the framework is structured, the basic features that Django offers as the framework par excellence for creating CRUD processes, ranging from creating views, templates, connecting with models, routing, form validations, creating middleware, among others.

Ultimately, you will have a wealth of material at your disposal to build true web applications.

Who this Book is for

This Book is aimed at anyone who wants to start developing with Django; you might come from another framework or even PHP; in both cases, it's a great idea to learn one of the most advanced and complete web frameworks you can find.

  • For those who want to know the framework and know other web frameworks, but don't have the necessary knowledge to venture into these.
  • For those who want to learn something new, to know about a framework that, although it has a lot of documentation, most of it is in English and, being constantly evolving, tends to become outdated.
  • For people who want to improve a skill in web development, who want to grow as a developer and who want to continue scaling their path with other similar frameworks.
  • For those who want to learn or improve a skill and, with this, increase their job prospects or to carry out a personal project.
  • If you come from another framework or language
    • If you come from PHP, Laravel, Flask, FastAPI, or even JavaScript, you'll feel right at home.
  • If you are looking for a career path as a backend developer
    • Django is still one of the most demanded frameworks in Python.
  • If you need a clear, updated Book in Spanish
    • Many resources are in English or outdated. Here you will have everything in Spanish and up to date.

 

Book and Book Curriculum

This book has a total of 20 chapters (still in development). It is recommended that you read in the order in which they are arranged and as we explain the components of the framework, go directly to practice, replicate, test, and modify the codes shown in this book; the book is currently under development.

  1. Chapter 1: In this chapter, we will present the necessary software to create projects in Django, from Python to preparing the environment.
  2. Chapter 2: In this chapter, we will install Python, create a project and applications, and learn the framework's folder structure.
  3. Chapter 3: In this chapter, we will create a simple CRUD application and learn all the framework's elements that this implies, such as form handling, templates, views, and models.
  4. Chapter 4: In this chapter, we will work with Django Admin to provide an interface for managing site content; that is, the typical CRUDs.
  5. Chapter 5: In this chapter, we will present the use of forms in Django, definition, validations, saving, and general structure.
  6. Chapter 6: In this chapter, we will present the different functionalities that templates have in Django.
  7. Chapter 7: In this chapter, we will present some functions that we can use with QuerySets when constructing queries.
  8. Chapter 8: In this chapter, we will build a Rest API with Django Rest Framework.
  9. Chapter 9: In this chapter, we will consume the previous Rest API with an application in Vue 3 and NaiveUI; lists and forms will be created and integrated with Tailwind.css
  10. Chapter 10: In this chapter, we will learn about Class-Based Views by performing the typical operations needed in modern web development.
  11. Chapter 11: In this chapter, we will learn how to work with files in Django; specifically reading and generating excels and CSVs and generating PDFs
  12. Chapter 12: In this chapter, we will show the code for an application created with Alpine.js to create a to-do list component.
  13. Chapter 13: In this chapter, we will adapt the Alpine.js application presented in the previous chapter to work in conjunction with Django.
  14. Chapter 14: Django Channels, In this chapter, we will use Django Channels to learn how to create systems with full-duplex communication and be able to create our own websockets and consume them; we will see how to create single and multiple channel applications, as well as how to consume a consumer from a Vue app.
  15. Chapter 15: Custom Authentication, In this chapter, we will create a custom authentication module with login, registration, password recovery, email sending, avatar upload, among others.
  16. Chapter 16: Signals, In this chapter, we will learn how to use the signals system to intercept events in Django such as the creation of entities in the database and execute personalized code.
  17. Chapter 17: Introduction to Testing, In this chapter, we will introduce the use of tests to create automated functions and test different modules of our application.
  18. Chapter 18: Deployment, We will see how we can deploy the project on the Railway and PythonAnywhere service.
  19. Chapter 20: Integrate PayPal, We will create a small online store by integrating PayPal with Django; we will learn the entire integration process.

 

 

 

Modules

  • Module 1: Introduction to Django and your first project
    • Installation, virtual environment, project structure, and your first app.
  • Module 2: Models, ORM, and Migrations
    • Model creation, migrations, data modification, relationships.
  • Module 3: URLs, Views, and Templates
    • Dynamic routes, function and class-based views, presentation logic.
  • Module 4: Forms, Validations, and Authentication
    • Form creation, custom validations, login, and registration.
  • Module 5: Advanced Django Admin
    • Customization, filters, actions, professional administration.
  • Module 6: Django Rest Framework
    • API creation, serializers, viewsets, token authentication.
    • Consume via Vue.
  • Module 7: Deployment on pythonAnywhere and Railway

 

 

 

Why learn Django today?

The power of the "batteries-included framework"

Django doesn't stop at the basics. From the first project, you have authentication, models, forms, automatic validation, ORM, administrative panel, and a super flexible template system. The first time I saw Django Admin, I literally thought, "How can something that comes ready-made be so powerful?". That feeling was one of the reasons that led me not only to learn Django but also to create this Book to teach it clearly and practically.

What kind of projects you can build with Django

With Django, you can create practically any type of web application:

  • E-commerce
  • Educational platforms
  • Management systems
  • REST APIs
  • Dashboards
  • Internal corporate applications
  • Sites with authentication and role-based permissions

And if you combine Django with Django REST Framework, you can build everything from microservices to complete APIs for mobile apps.

Why Django remains a reference in Python

Django has been stably evolving for almost two decades. It is mature, professional, used by giant companies, and, above all, practical. In a world where everything changes quickly, Django continues to offer a solid foundation that doesn't break every 6 months.
 

We will cover a wide range of essential and indispensable topics:

  • Basic Aspects: Routes, views, templates, models, form handling, and validations.
  • Advanced Development:
    • Rest API: Implementation of APIs with Django Rest Framework (DRF) and token-based authentication systems.
    • Key Packages: Use of Django Channels and other essential packages from the Django ecosystem.

The complete curriculum detail is at the bottom of this post.

 

This book is intended to take your first steps with Django; from scratch, knowing how to manage forms, views, templates, models, migrations, QuerySet, Rest Api, consuming through Vue 3 and much more.

I agree to receive announcements of interest about this Blog.

Algunas recomendaciones:

Benjamin Huizar Barajas

Laravel Legacy - Ya había tomado este curso pero era cuando estaba la versión 7 u 8. Ahora con la ac...

Andrés Rolán Torres

Laravel Legacy - Cumple de sobras con su propósito. Se nota el grandísimo esfuerzo puesto en este cu...

Cristian Semeria Cortes

Laravel Legacy - El curso la verdad esta muy bueno, por error compre este cuando ya estaba la versi...

Bryan Montes

Laravel Legacy - Hasta el momento el profesor es muy claro en cuanto al proceso de enseñanza y se pu...

José Nephtali Frías Cortés

Fllask 3 - Hasta el momento, están muy claras las expectativas del curso

Andrés Cruz

ES En español