Django | Server Setup (WSGI, Gunicorn, Nginx)
Вставка
- Опубліковано 5 вер 2024
- A tutorial on how a Django project runs in development and production environments.
I also show how to run a Django project using a WSGI server (Gunicorn) and a web server (Nginx).
its funny that such an important concept its never explained in other channels, they can talk about django all day long, but fail to explain the professional way of deploying apps
That's 1000000000000000....% correct. Come Back Mam, you have things that no one has.
100% bro. amen to that.
Because they don't know themselves.
😆🤌🏻
Digital ocean has blog post on it.
Never seen a django deployment tutorial as explanatory as this. I was totally struggling thanks!!
Thanks, great video! I am learning Django deployment and always get afraid when I hear the terms Nginx and Gunicorn but you made them very clear now!
I'm so glad you understand them better now :)
@@djangoroad read: you are looser. Do you know why you stopped... creating the content? I was going to write this but you are not my slave. !00 and 2 o/o. that's your choice great videos mam. I pray you will come back not for us but .....
Hahaha been there
I've watched 10 videos on this topic so far and some of them were 50 mins long "in the name of explaining in details" but this brief and well done video was the best and the clearest so far.
Wait, I think you dropped this 👑
Such a simple and clear tutorial ! I have not seen another Django tutorial that explains the concept in such a clear way. Thank you for creating this video.
Thank you from South Korea! I have never seen such a easy-to-understand lecture to get the concept of web server❤
Thanks for the support :)
Great content explained in such an easy-to-understand way. I loved how you broke down the concepts then showed them in practice.
This is the simplest explanation I have found thus far. Thank you so much!
I love you, literally saved me from hours of endless headscratching; I'm new to this so its still pretty daunting to say the least :/
Clear and simple instructions. Still a great tutorial in 2024!
I had been struggling following the gunicorn docs and understanding the relation between Nginx-Gunicorn-Django, then I found your video that put it all together very succinctly. Thank you for the time and effort you took to make the video and post it on you-tube. Your effort has been greatly appreciated and helped me greatly. Thank you.
Thanks for the comment :) I'm glad you found the video helpful.
Goodluck!
so I'm watching this tutorial 2 years later, and guess what, my testimony still resonates with the many appraisal comments. good work @django road
Thanks!
Nice tutorial. Complete, to the point, and, most importantly, correct.
This tutorial is bang on the money. I've followed an hour long video and not got it working, this last 9 mins and DOES work. Brilliant. If you get a chance could you do one on setting up SSL and port 443 with Django on a production site?
Thank you Dot JA 🙂
Finally a tutorial speaking human language
Nicely explained 🙏
It's so rare that I click like on a video, but wow this was a great video. Had to go seerching in my apps UI to even find the button. Thank you for the explanation.
Thanks, I appreciate it!
OMG... the way you explained this is so clear... Many thanks really. Now investigating to add more security to the site! Cheers!
In my organisation, our huge django application is configured with both gunicorn and nginx as web server. I had so many confusions in the configuration coupling. Now I have a clear picture after watching your explanation. And one more thing, I would like you to make a similar video on nginx proxy server configuration for load balancing django application. As the user base grows, proxy server is the way to scale with proper cpu utilisation.
Great video by the way. Keep up the good work. Thanks
God bless you! 3 years old video and still the best one over YT))
Thanks mam, my first deployment done seamlessly.
Hope to cover this topics too:
Django with lambda, Scaling
Django with Docker, Kubernet
Django with S3 Bucket
Django with RDBMS (handle/Fetch data from the different database)
cover with AWS.
Nice ideas! Thanks
Great points! A resource discussing this would be immensely helpful.
@@SwapnilPhulse +1
Very good, it is the easy way that you show about how to deploy django app.
exactly what I was looking for. I have to install Django on a server on an intranet. this came in very handy
Thankyou very much for making this fantastic video, this video helped me setup my first website with django, still relevant after 2 years, thanks.
I've just come to your channel, great content, but believe there is a lot u can offer to the community, keep It up.🥰
your content is great buddy, just keep patience and continue making useful videos, and you will have huge reach. Thanks again, looking forward for more django and web development related videos.
thank you very much - جزاکم اللہ احسن الجزاء
thank you so much, your videos are amazing, simple and direct to the point with clear explanation.
Excellent video. Please make one on how to deploy multiple django sites on 1 server using this.
Thank you so much for making this video. After days of me constantly failing, you realy helped me out!
Great video! Simple deomonstration of the tool :)
One note: in my case, isntead of "root" I needed "alias" for the static files (location /static/)
Marvelous explanation!
Thanks.It is so easy understandable for me than other videos.
Wow, that was a masterpiece of explanation! Thank you 🙏
Incredible! Super intuitive and well explained. Thank you!!!!
It was a very direct explanation and simple, but it's straight to the point. I liked it. Thank you :)
Thank you for this tutorial. I was struggling to get the final piece with gunicorn setup "pythonpath" and "command" vars were missing. I kept scratching my head as to why the workers weren't spawning. You awesome!!!!!
This was so helpful, thank you so much
This was PEAK content! Very well explained. Just one question, I know I'm very late, but why did we need to create a specific route for /static/ in nginx ? What if we don't give it, django anyways is going to handle those right, after we run `collectstatic`?
really nice tutorial, looking forward to more videos
thanks :)
Thx a lot! Thats a great short video that covers the basics needed 👍👍
I get a 502 Bad Gateway error. I tried to fix it for the last couple of days and I can't. Does anyone have any idea how to solve it?
Hey make more of these deployment type videos. They are super helpful
Easy to understand great presentation.
Also if you are on a VPS or similar, you need to allow port 8000 on the provider side, e.g. change AWS EC2 inbound rules for your instance to allow custom tcp port range 8000. Otherwise you will keep getting connection refused.
Hi, this is an awesome video! If possible, you should follow this up with how you would integrate certbot.
One of the best videos I've ever watched. Thanks!
Thank you very much It is very useful Tutorial
This is excellent, thanks for the tutorial. Got it working on an AWS EC2. Not sure why I did the docker version of this tutorial before this one but whatever
Hi , did you add ip of EC2 in allowed host ??
@@Poo1199-c1o Yes. It's not good practice but I think you can do ['*'] to allow any host also
@@soffer I am getting 502 error while accessing the instance IP.. do you know how that can be resolved?
@@Poo1199-c1o Sorry I am not an expert. That makes me think nginx is running and trying to hit gunicorn but gunicorn has an issue. is gunicorn running? i believe it should be: user clicks goes to your web page -> nginx gets request -> request passed to gunicorn -> something goes wrong and 502
This was super insightful! Thank you so much. You're the best.
Thankyou so much , for such wonderful explaination.
Thank you so much, it was so well explained!
You are so awesome, it's so clean, thank you one million times !
I'm trying so hard to setup Django with OpenLiteSpeed and his module LSAPI. If you're looking for a new tutoriel 😅
explanation is so clear, thank you
Thanks a lot. That was really helpful. Straight to the point.
thank you very much, this is the best explanation
Excellent. Well appreciated. Simple and elegant. ❤️ from Chn Greater Bharat
Great tutorial I love your teaching method
very clear and onto the point
Super. Thanks from Uzbekistan
Great video, thank you!
However there's a small mistake at the end (I think), in the Nginx config where you're using "root /home/ubuntu/static",
that wouldn't work because it will resolve to home/ubuntu/static/static
I suppose it worked at the end because debug was still set to True
Thank you, the best tutorial on the topic
Perfect, thanks alot!
But, i have a question regarding deploying new services on the same server.
Should i do it like that:
1. Deploy new django service in new container qith gunicorn.
2. Edit nginx service to serve both old and new services.
wow, perfect tutorial, thank you so much
perfect explained, thank you!
Concise and clear, thank you.
Thanks, great video!
thanks for your video. I have an error "No module named "myproject.wsgi". Any idea to fix it?
Very very obvious and useful. Thanks!
thank you so much, I followed a digital ocean tutorial and couldnt get my app to be served, I am wondering why this very simplified approach gets the job done. Is this all the setup I have to do? what are the next steps? thank you so much.
A slick tutorial, well done! Are media files treated the same as static files or is there another configuration needed for production?
Thanks for the feedback! Media files are treated same as static, you can specify the location in the Django configuration as well as the Nginx config. Depending on the traffic you receive to your web app, you might also want to look into S3 for storing this type of content.
Love from India. Keep going ❤️
very simple and useful 😸 💚💚
Keep going ☺️
Thank you for explanation
Nice video, thanks.
I just wonder what’s the difference or pros and cons between serving statics with WhiteNoise vs serving statics with web server.
Although I guess in production for real projects, statics will be serve by a cdn, right ?
Clear tutorial ,Keep going ,thanks 👍
This is just perfect! Thanks alot!
very simple and informative
Good job 👍 simple and effective
thank you!!! you literally save my life lol
This is really great !
Thank You !
Thanks! Great explanation 🔥
this finally worked thank you.
At 5:05, what and from where did you copy and paste? I am using a Mac and want to get the correct path for both the `command` and `pythonpath` variables. Thank you!
Thank you for video!
But what is your IP in the Nginx config and why do you need to specify it there explicitly?
I thought it can be some kind of alias that refers to the primary netrowk interface and assigned IP to it by the network provide.
Thank you so much, great job!
Thanks from Venezuela!!
thanks this work with ubuntu 22.04 UEFI on alibaba cloud, with django 5.0
Great tutorial, thanks a lot
Do you know if, once you place the static files in the /static/ folder, you have to set some permissions?
hey thanks a ton...this was what i needed
for anyone who might be running into the same problem as I am. I don't know but placing the complete static directory path in my settings.py did not work ( I reference static files using the static tag, that might have something to do with it)
what finally worked for me is settings.py:
STATIC_URL = '/static/'
and in the nginx configuration
location /static/ {
root {my project path without the '/static/' at the end };
}
DUDE THANKS it worked for me aswell
Thanks a lot for this interesting tutorial
Excuse me I am struggling to set up permanently a web site in Django with supervisor.
The site works well when it's started manually, but when I use supervisor it does not work.
Do you have any video that explains how to set the site permanently?
Thanks in advance
Now it works well.
Thanks for the interesting video
wow! straight to the point
Informative video, thank you
Perfect you explained the concept very easily in plain English. Can I add the Postgres template to my project structure?
Yeah you can, I think I have videos on that topic in this channel.
crystal clear. Thank you !
Once you make it work on nginx. Will I be able to access it with other devices using my wifi network, by typing in the public IP?
Thanks. I ll try Gunicorn