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
@@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 .....
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.
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 🙂
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.
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!
my django-admin panel static files not showing, why ? i have properly configured the path of static files in nginx configuration. Django admin panel looks ugly why my static files are not working?
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`?
@@frankstuart6032 remember you have to put path only till the dir which contain wsgi.py file. So that you can use myproject.wsgi in command for example if your wsgi file is located in: home/username/myproject/myproject/wsgi.py your pythonpath should be: PYTHONPATH="/home/username/myproject"
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
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.
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.
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 ?
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, 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.
it pretty work, but at last step i can see you use your ip address to see django test page with rocket. But i can see this page only when i type :8000, when i type only my address i see "Welcome to nginx" page. Can you help me with this, please?
Thanks for such a clear explanation!! Can anyone tell me how to config gunicorn_config.py file for respawning the worker if it failed and how to restart it automatically?
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.
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.
Thanks! I was using the IP of an instance from a cloud provider (AWS, GCP, DigitalOcean, etc). I find this way better than using my own computer because you can always delete the instance and create a new one if something goes wrong.
The configuration files all use lots of absolute paths to things, hard-coded IP addresses, etc, which are hacky and non-portable, and some of it is unnecessary (like the hard-coded IP address). I don't think this is a good way to configure any project. Better to have a look at the Gunicorn documentation or try another tutorial.
If you are working with ec2 instance you might found a issue where gunicorn will not start with your_ip_address:8000 use 0.0.0.0:8000 it should work then
Thanks a lot it was very interesting. However, is this a way that can be used to deploy an industrial django application or their is more things to be taken into account when we want to deploy a real production one? If no what kind of things (certificates, crypting, token,...) and on which level should be handled (app itself, WISGI, NginX) ?Thanks
hello maam. Thank you for this video. Just wanna clarify, this is how we deploy django projects into working websites, right? So, the IP address you entered is the hosting site or the IP you got from the hosting site?
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 }; }
im testing this on a pi and the only issue im running into is job for nginx.service failed because the control process exited with error code. have you ever seen that before? I double checked my config files
Could you please correct the static path in your nginx/sites-available/myproject file? Subtitles would do :) It works only by accident, because the default page doesnt need static files.
So, your captions have auto generated in dutch, and are incoherent. This video isn't at all accessible to anyone deaf or hearing impaired, is it possible you could re-generate the captions so I can actually make sense of this?
Hi Abby, apologies this video isn't accessible to you. I've edited the video to set the language to English. By "re-generate" the captions, do you mean enter the audio subtitles manually? or is there a way to auto-generate it?
@@djangoroad well, now it doesn’t have any captions at all. I don’t know the process for adding captions on here, because I’m not the one that’s a RU-vid content creator so I don’t know it’s tools.
Thank you. This is a great video. My question is if we can set guicorn as a service? thus, we do not need to activate the virtual environment or run any script after rebooting the server.
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.