Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Django IntroductionChapter 6. Deploy Django App

Chapter 6. Deploy Django App

Deploying Your Django App

This chapter covers how to deploy your Django app in the production environment. We'll also explain how to manage several software tools and services through the deployment process, such as AWS Lightsail, GitHub, PostgreSQL, Nginx, GCP (Google Cloud Platform), and SendGrid.

What We Cover in This Chapter

The following topics are covered in this chapter:

Overview of Django App Deployment (1)

In this section, we'll discuss the basic concepts of deploying your Django app in the production environment and the importance of making your app accessible to the public.

Overview of Django App Deployment (2)

In this section, we'll dive deeper into the choices involved in the deployment process, such as selecting a hosting service, deciding on the operating system, and choosing the database for production.

Key Steps of Django App Deployment

This part provides an overview of the eight key steps in deploying your Django app from scratch, covering everything from setting up hosting services to configuring production databases and handling email settings.

Hosting Service Initial Settings (1) – AWS Lightsail Setup

Learn how to prepare your AWS Lightsail instance, set up an Ubuntu instance, and attach a static IP address to make your Django app accessible online.

Hosting Service Initial Settings (2) – SSH Remote Connection

This section explains how to establish a secure SSH remote connection between your local machine and the Ubuntu server for remote management of your Django app.

Manage Local Computer and Remote Server Simultaneously

Managing both local development and remote production environments is crucial. We'll cover tips and techniques for handling both simultaneously to avoid errors and ensure smooth workflows.

Tips for Managing Local Development and Remote Production Environment

This section provides important tips for managing differences between local and production environments, focusing on .gitignore, dependencies, and settings management.

Hosting Service Initial Settings (3) – Clone Project Directory with GitHub

Learn how to push your project code from your local machine to GitHub and then clone it onto your production server to keep both environments synchronized.

Production Database Setup

In this section, we'll walk you through setting up PostgreSQL for production and configuring the database settings for your Django app.

Django App Production Configuration (1) – Edit settings.py

Learn how to adjust your settings.py file to configure your app for both development and production environments, including managing environment variables securely using the .env file.

Django App Production Configuration (2) – Production Settings

This section covers the critical production settings that must be configured for optimal security and performance in the production environment.

Django App Production Configuration (3) – django-environ and .env File

Learn how to use the django-environ library to manage environment variables securely, particularly for sensitive information like API keys and passwords.

Static File Settings

Understand how to manage static files for your Django app in the production environment, including the setup of Nginx for static file handling.

Django and Dependency Installation on Production Server

This part explains how to install Django and its dependencies in a virtual environment on your production server to ensure consistency and stability.

Web Server and Application Server in Django

Learn about the key roles of web and application servers in deploying a Django app and how to set them up using Nginx and Gunicorn.

Application Server Setup – Gunicorn

We’ll explain how to configure Gunicorn, an application server, to run your Django app in the background using systemd on your Linux server.

Web Server Setup – Nginx

Set up Nginx as the web server for your Django app, handling static files and forwarding dynamic requests to the Gunicorn application server.

Domain Setup

Learn how to link your web app to a custom domain name, making it more user-friendly and accessible instead of relying on a raw IP address.

SSL Setup – Certbot

This section covers how to use Certbot to obtain and configure a free SSL certificate from Let's Encrypt, enabling secure HTTPS communication for your Django app.

Email Setting – SendGrid

Set up SendGrid to handle email sending in production, including registration, API key creation, and configuring Django settings for email functionality.

Social Login for Production

Learn how to configure social logins for production, including setting up OAuth apps on GitHub and Google, and adjusting the callback URLs for your domain.

Manage Local Development and Remote Production Environment

In this final section, we summarize how to effectively manage both the local development environment and the remote production environment, covering the use of different requirements files, settings configurations, and common commands for each environment.

Learn offline for better focus!
A book for this course is available on Amazon.

Django Visual Guide

Step-By-Step Manual for Complete Beginners to Mastering Django, Python, and Web Development.

Your browser does not support the video tag.
Get the Book Now

More Topics to Explore

Setting Up a Virtual Environment for Django

Set Up Virtual Environment

Creating One-To-Many Relationships with ForeignKey

Django Models – ForeignKey (OneToMany Relationship)

Setting Up a Virtual Environment for Django

Set Up Virtual Environment

Creating One-To-Many Relationships with ForeignKey

Django Models – ForeignKey (OneToMany Relationship)

Tags:

GitHub

Nginx

Django

Production Environment

PostgreSQL

SendGrid

AWS Lightsail

App Deployment

Google Cloud Platform

Django Introduction
Course Content

Chapter 1. Django Key Concepts

Web Framework and Django

Websites vs. Django Web Apps

How Django Handles HTTP Request and HTTP Response

Django's MVT Framework

Django Templates vs. Django APIs

Chapter 2. Django Quick Start Guide

Install Python

Install Visual Studio Code

Create Project Directory

Set Up Virtual Environment

Install Django

Start Django Project

Run Server

Database Migration

URL dispatcher – urls.py

Create Superuser and Log In to Django Admin

Start App

Create HTML Templates

Create Views

Add URL Patterns

Project vs. App

Chapter 3. Django Models and Databases

Create a Database in Django

Relational Database

Create Django Models

Makemigrations and Migrate

Add Models in Django Admin – admin.py

Change Display Name of Record Objects

Django Models – Data Field Type

Django Models – Field Options

Django Models – Help Text Option

Django Models – Choices Option

Django Models – DateField with datetime Module

Django Models – Relationship Fields

Django Models – ID

Django Models – ForeignKey (OneToMany Relationship)

Django Models – OneToOneField

Django Models – ManyToManyField

Chapter 4. Create CRUD Web Application

CRUD Web Application

Basic CRUD Structure in Django

Django Generic Views

How To Write Class-Based Views with Generic Views

Generic View Basic Attributes

URL Dispatcher for CRUD Views

Django Templates for CRUD Views

Django Template Language (DTL)

Template for List Page

get_FOO_display method

Template for Detail Page

Template with Model Relations

Template for Create and Update Page

Template for Delete Page

Add Links – {% url %} tag

Extend Templates – {% extends %} tag

Check Developing App UI on Mobile Device

Django Templates with Bootstrap

Crispy Forms

Customize Views (1) – Change List Order

Customizing Views (2) – Filter Lists

Context

Customize Views (3) – Add Extra Context

Modularize Templates – {% include %} tag

Static Files in Development Environment – {% static %} tag

STATIC_URL and STATICFILES_DIRS

Create Index HTML

Chapter 5. User Management

User Authentication

Overview of User Management Functions

User Management Function Development with Django

Approaches to Building User Management Functions in Django

Django Allauth (1) – Introduction

Django Allauth (2) – Installation and Initial Settings

Django Allauth (3) – Email Verification via Console

Django Allauth (4) – Email Verification via Gmail

Django Allauth (5) – Social Login with GitHub

Django Allauth (6) – Social Login with Google

Django Allauth (7) – Allauth Template File Setup

Django Allauth (8) – Add Basic Styling with Bootstrap and Crispy Forms

Django Allauth (9) – Customize Sign-in and Sign-up Pages

User Models

Login Required – LoginRequiredMixin

User Login Status Icon on Navigation Bar

Chapter 6. Deploy Django App

Overview of Django App Deployment (1)

Overview of Django App Deployment (2)

Key Steps of Django App Deployment

Hosting Service Initial Settings (1) – AWS Lightsail setup

Hosting Service Initial Settings (2) – SSH Remote Connection

Manage Local Computer and Remote Server Simultaneously

Tips for Managing Local Development and Remote Production Environment

Hosting Service Initial Settings (3) – Clone Project Directory with GitHub

Production Database Setup

Django Production Settings (1) – Settings.py for Development and Production

Django Production Settings (2) – Production Settings

Django Production Settings (3) – django-environ and .env file

Static File Settings

Django and Dependency Installation on Production Server

Web Server and Application Server in Django

Application Server Setup – Gunicorn

Web Server Setup – Nginx

Domain Setup

SSL Setup – Certbot

Email Setting – SendGrid

Social Login for Production

Manage Local Development and Remote Production Environment

Chapter 1. Django Key Concepts

Web Framework and Django

Websites vs. Django Web Apps

How Django Handles HTTP Request and HTTP Response

Django's MVT Framework

Django Templates vs. Django APIs

Chapter 2. Django Quick Start Guide

Install Python

Install Visual Studio Code

Create Project Directory

Set Up Virtual Environment

Install Django

Start Django Project

Run Server

Database Migration

URL dispatcher – urls.py

Create Superuser and Log In to Django Admin

Start App

Create HTML Templates

Create Views

Add URL Patterns

Project vs. App

Chapter 3. Django Models and Databases

Create a Database in Django

Relational Database

Create Django Models

Makemigrations and Migrate

Add Models in Django Admin – admin.py

Change Display Name of Record Objects

Django Models – Data Field Type

Django Models – Field Options

Django Models – Help Text Option

Django Models – Choices Option

Django Models – DateField with datetime Module

Django Models – Relationship Fields

Django Models – ID

Django Models – ForeignKey (OneToMany Relationship)

Django Models – OneToOneField

Django Models – ManyToManyField

Chapter 4. Create CRUD Web Application

CRUD Web Application

Basic CRUD Structure in Django

Django Generic Views

How To Write Class-Based Views with Generic Views

Generic View Basic Attributes

URL Dispatcher for CRUD Views

Django Templates for CRUD Views

Django Template Language (DTL)

Template for List Page

get_FOO_display method

Template for Detail Page

Template with Model Relations

Template for Create and Update Page

Template for Delete Page

Add Links – {% url %} tag

Extend Templates – {% extends %} tag

Check Developing App UI on Mobile Device

Django Templates with Bootstrap

Crispy Forms

Customize Views (1) – Change List Order

Customizing Views (2) – Filter Lists

Context

Customize Views (3) – Add Extra Context

Modularize Templates – {% include %} tag

Static Files in Development Environment – {% static %} tag

STATIC_URL and STATICFILES_DIRS

Create Index HTML

Chapter 5. User Management

User Authentication

Overview of User Management Functions

User Management Function Development with Django

Approaches to Building User Management Functions in Django

Django Allauth (1) – Introduction

Django Allauth (2) – Installation and Initial Settings

Django Allauth (3) – Email Verification via Console

Django Allauth (4) – Email Verification via Gmail

Django Allauth (5) – Social Login with GitHub

Django Allauth (6) – Social Login with Google

Django Allauth (7) – Allauth Template File Setup

Django Allauth (8) – Add Basic Styling with Bootstrap and Crispy Forms

Django Allauth (9) – Customize Sign-in and Sign-up Pages

User Models

Login Required – LoginRequiredMixin

User Login Status Icon on Navigation Bar

Chapter 6. Deploy Django App

Overview of Django App Deployment (1)

Overview of Django App Deployment (2)

Key Steps of Django App Deployment

Hosting Service Initial Settings (1) – AWS Lightsail setup

Hosting Service Initial Settings (2) – SSH Remote Connection

Manage Local Computer and Remote Server Simultaneously

Tips for Managing Local Development and Remote Production Environment

Hosting Service Initial Settings (3) – Clone Project Directory with GitHub

Production Database Setup

Django Production Settings (1) – Settings.py for Development and Production

Django Production Settings (2) – Production Settings

Django Production Settings (3) – django-environ and .env file

Static File Settings

Django and Dependency Installation on Production Server

Web Server and Application Server in Django

Application Server Setup – Gunicorn

Web Server Setup – Nginx

Domain Setup

SSL Setup – Certbot

Email Setting – SendGrid

Social Login for Production

Manage Local Development and Remote Production Environment