Linux serverlinux web serverNETWORK ADMINISTRATIONS

How deploy a Django application using Nginx & Gunicorn in Production

How to deploy Django website on ubuntu 20.04 using Nginx and Gunicorn:
In this video, we will see how to deploy our Django website in production using Nginx and gunicorn on ubuntu. Nginx will be used as a reverse proxy
►Text Tutorial: https://www.codewithharry.com/blogpost/django-deploy-nginx-gunicorn
►Deployment Playlist: https://www.youtube.com/playlist?list=PLu0W_9lII9aiBNXUisDdSmfNbsKq407XC
►Check out my English channel here: https://www.youtube.com/ProgrammingWithHarry
►Click here to subscribe – https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww

Best Hindi Videos For Learning Programming:
►Learn Python In One Video – https://www.youtube.com/watch?v=ihk_Xglr164

►Python Complete Course In Hindi – https://www.youtube.com/playlist?list=PLu0W_9lII9agICnT8t4iYVSZ3eykIAOME

►C Language Complete Course In Hindi –

►JavaScript Complete Course In Hindi –

►Learn JavaScript in One Video – https://www.youtube.com/watch?v=onbBV0uFVpo

►Learn PHP In One Video – https://www.youtube.com/watch?v=xW7ro3lwaCI

►Django Complete Course In Hindi –

►Machine Learning Using Python – https://www.youtube.com/playlist?list=PLu0W_9lII9ai6fAMHp-acBmJONT7Y4BSG

►Creating & Hosting A Website (Tech Blog) Using Python – https://www.youtube.com/playlist?list=PLu0W_9lII9agAiWp6Y41ueUKx1VcTRxmf

►Advanced Python Tutorials – https://www.youtube.com/playlist?list=PLu0W_9lII9aiJWQ7VhY712fuimEpQZYp4

►Object Oriented Programming In Python – https://www.youtube.com/playlist?list=PLu0W_9lII9ahfRrhFcoB-4lpp9YaBmdCP

►Python Data Science and Big Data Tutorials – https://www.youtube.com/playlist?list=PLu0W_9lII9agK8pojo23OHiNz3Jm6VQCH

Follow Me On Social Media
►Website (created using Flask) – http://www.codewithharry.com
►Facebook – https://www.facebook.com/CodeWithHarry
►Instagram – https://www.instagram.com/codewithharry/
►Personal Facebook A/c – https://www.facebook.com/geekyharis
Twitter – https://twitter.com/Haris_Is_Here
Comment “#HarryBhai” if you read this 😉😉

source

by CodeWithHarry

linux web server

43 thoughts on “How deploy a Django application using Nginx & Gunicorn in Production

  • Worst explanation
    Man just copy pasted didn’t explained clearly

  • It's July 2023, will all these commands work in the same manner as shown in the Video, as I am learning the Deployment? by Buying the Digital Ocean VPS.

  • Even after following step by step, the page is not loading and it says server timed out. Firewall is inactive, ports are allowed and everything works. Except the webpage. Please help.

  • Hi . bro .. i am getting this error and showing 502 bad request.. upstream prematurely closed connection while reading response header from upstream

  • you should have better shown: setting up DNS to our server instance ip address. which could clarify the viewers.
    I guess many were confused how the domain name was set.

    But the tutorial was informative and short. Thanks.

  • I cannot find these location in mac. Is there any documentation to setup these in mac? Please help!

  • I will follow you step by step successfully and host my django site in the digital ocean. Thank u so much sir.
    I have some queries like
    Every thing we do via command line any gui is not available for easier our tasks.
    If we use centos instead of ubuntu any extra advantage we get or not ?
    I have facing much problem regarding backup of my database if any solution please give sir.

  • Sudu kya hai kuch samajh nhi aaya

  • you didn't update service section till( restart=always restartsec=3). Please update it..

  • one question u open ssh window by typing tutorial how any one tell me??

  • believe me his blog is in link and it is the only one blog that has helped me successfully deploy my django website first time in my life. I know his blog lacks some points , I will metion them here:
    he forgot to sudo systemctl daemon-reload after creating nginx socket file

    check some errors if nginx faces using sudo nginx -t

    delete extra firewall using : sudo ufw delete allow 8000 at second last

    allow nginx throug firewall using: sudo ufw allow 'Nginx Full'

    if you properly follow his blog and use my steps above, you will not get errors that commenters below are facing

  • Hi.. can't start gunicorn.socket.
    Saying Error: Unit gunicorn.socket has a bad unit file setting.
    Pls help.

  • I am on oracle cloud and I am not able to finish on 11:51. I am not able to ping my public IP also I never seen this welcome page by django. Could someone help

  • how to deploy application and database in separated Ubuntu VMs?

  • Hello. You didn't tell how to serve static and media files. I believe when we run the server on production, Django doesn't serve static files itself anymore.

  • Harry bhai ager app ko PfSence main proxy k bary main b aik video bana deen
    Great knowledgably video

  • I have a problem in production there are no CSS designs on the admin panel and its looking horrible

  • client_loop: send disconnect: Broken pipe
    How to solve this error

  • if we are using Models and databases in our django appand if we are taking data in form from frontend and storing it in database in django using models then how can we view that data after our project is deployed??

  • Hello harry bro
    i am getting like this error "502 Bad Gateway".
    how i can resolve this can you help me?

  • Hello sir can we do this in aws instance as you have used Linux server

  • Hello Harry Bhai, I was able to deploy my django website successfully, But Static files are not working on production level, mene online try kiya but jyada kuch samjh nhi aa rha h please help me out 😊😊

    This is my settings for static files in settings.py

    STATIC_URL = '/static/'

    STATIC_ROOT = BASE_DIR /'static'

    STATICFILES_DIRS = [

    'RentHouse/static/',

    ]

    # media files configurations

    MEDIA_URL = '/media/'

    MEDIA_ROOT = BASE_DIR /'media'

    #urls.py
    from django.conf.urls.static import static

    from django.conf import settings

    urlpatterns = [

    path("", views.index, name='index'),

    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

  • Hello Harry Bhai, I need some help. Actually, I am hosting my Django website on Cpanel, and all static files are working properly but the website is not able to access the media files when debug = false

Comments are closed.