Django Deployment: How to deploy Django app to server using Nginx + Uvicorn | Django deploy tutorial

Published: 04 October 2021
on channel: Red Eyed Coder Club
7,455
189

This Django Deployment to server video is about how to deploy Django project with Vue.js static files (that are generated by Webpack) to a remote server using Nginx, PostgreSQL and Uvicorn.

In this Django Deployment Tutorial I use an Ubuntu Server 20.04 that is running an a Virtual Machine instead of VPS, but actually it doesn't matter, because it's the same Ubuntu.

To deploy Django project on server I used Supervisor - the process manager, that is responsible for starting and restarting of the Django project.
Also with Django I used Uvicorn instead of GUnicorn. Uvicorn is the WSGI (ASGI) interface between the Nginx and Django. I didn't use GUnicorn here because Django 3 is asynchronous framework, and as for now it's a bit tricky to use the Gunicorn with it. So I use Uvicorn for Django.

This "Deploy Django to a server" video is a continuation of the Django Vue.js Integration for Production:
   • Django Vue.js Integration for Product...  
And it's idea is to show that the video about Integration is a working way of doing things.

Follow me @:
Telegram: https://t.me/red_eyed_coder_club
Twitter:   / codereyed  
Facebook: https://fb.me/redeyedcoderclub

Links:
Django deployment checklist: https://docs.djangoproject.com/en/3.1...

Gist with vue.config.js:
https://gist.github.com/zaemiel/faf8f...

Gist with commands to deploy Django project to a server:
https://gist.github.com/zaemiel/edfc6...


Timecodes:

[ Creating Django project with Vue.js ]

01:06 - What you need from VPS provider to deploy Django via SSH
02:39 - Creating a Django project, virtual environment
04:30 - Creating a Vue.js app
04:54 - Creating Django templates, static folders
06:03 - Creating Django base, index templates
07:27 - Vue.js index.html file content
08:57 - Django index.html content
09:53 - Django urls.py and view
10:40 - Webpack configuration - vue.config.js
11:20 - Test of Django + Vue.js integration

[ Prepare Django for deployment]

13:37 - Deploy Django preparation
14:08 - Installing python-dotenv, psycopg2
15:16 - Creating of .env, updating settings.py
16:43 - STATIC_ROOT, STATICFILES_DIRS
19:00 - Git repository initialization

[ Server Configuration ]

21:06 - Server configuration beginning
25:14 - Installing system packages
26:09 - PostgreSQL configuration
29:14 - Cloning Django project on server
29:47 - Creating a virtual environment, Installing Django dependencies
31:27 - settings.py PostgreSQL configuration
33:47 - collectstatic
34:20 - Installing Uvicorn, and checking connection to Django
36:34 - Supervisor configuration
41:22 - Nginx configuration
45:22 - Set ALLOWED_HOSTS
45:50 - Fixing the Nginx paths


➥➥➥ SUBSCRIBE FOR MORE VIDEOS ➥➥➥
Red Eyed Coder Club is the best place to learn Python programming and Django:
Subscribe ⇢    / @redeyedcoderclub  

Django Deployment: How to deploy Django app on server using Nginx + Uvicorn | Django deploy tutorial:
   • Django Deployment: How to deploy Djan...  

This video is about how to deploy Django project on server.

#deploydjango #djangodeployment #deploydjangoonserver #django #redeyedcoderclub