7 Critical Django Production Server Settings to Configure Before Going Live

  Рет қаралды 33,466

Tony Teaches Tech

Tony Teaches Tech

Күн бұрын

Пікірлер: 110
@madanielmadaniel
@madanielmadaniel 2 жыл бұрын
1:32 - As for the secret key, also recommended to check the module 'decouple'. It does the same thing but in more elegant way.
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Thanks for the tip Daniel
@ChiragVora
@ChiragVora 2 ай бұрын
Or dotenv. Modules like these also help to hide other credentials like database name password and username etc
@EvaLindner-v7v
@EvaLindner-v7v 9 ай бұрын
Clear, concise, competent and to the point. Thank you!
@TonyTeachesTech
@TonyTeachesTech 9 ай бұрын
You're welcome! Subscribe for more :)
@markwollert565
@markwollert565 3 жыл бұрын
Dude, I'm so grateful to you for the work you've done on all of your videos
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I appreciate that!
@jvoynar5826
@jvoynar5826 Жыл бұрын
Very nice, thank you!
@vectoralphaSec
@vectoralphaSec 9 ай бұрын
Have you made a video about deploying a Django site to a PaaS?? I feel IaaS is too hard and complicated for beginners like me. I don't feel i need all that control and setup a full Linux server from scratch for a simple portfolio website.
@anselsolomon6270
@anselsolomon6270 3 жыл бұрын
This is the first time am actually seeing someone on KZbin shows with detail how to configure settings for Django production environment....i really appreciate you much on this....please can you make a video on how to deployment django with ability to send emails?? And with postgresql as the database???.....Thanks alot
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Probably not postgres but I will consider a Django email tutorial :)
@arnauadell4824
@arnauadell4824 Жыл бұрын
Fucking amazing how quickly and concisely you could share all this information. And with very clear pronunciation too! Coming here in the future for any other django information I need.
@TonyTeachesTech
@TonyTeachesTech Жыл бұрын
🙏🙏🙏
@krzysztofszumko9080
@krzysztofszumko9080 4 жыл бұрын
Great Video! Straight to the point, no time wasted just awesome :). Keep up the good work.
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
I appreciate that 😊
@MadaMediaproduction
@MadaMediaproduction 2 жыл бұрын
Great video thank you , i have issue with deploying project with Django corntab its works normally in local but in after production its not working anymore any hint to fix this issue
@TheLolcheater
@TheLolcheater 2 жыл бұрын
Best Tutorial i have ever seen! Your Awsome!
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Thanks!!
@cheesecakelover2078
@cheesecakelover2078 3 жыл бұрын
This was an amazing video, learnt quite a lot of things which turned out to be very important! Thank you so much :)
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Sure thing!
@KenoAlordiah
@KenoAlordiah 3 жыл бұрын
Thank you so much for helping me figure this out. There were quite a number of settings I skipped on my production site settings.py file. Thanks once again.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You're welcome Keno !
@shivamdubey4783
@shivamdubey4783 2 жыл бұрын
Great tutorial sir do we have to change the file upload settings also
@agresiv0
@agresiv0 2 жыл бұрын
Is it best practice to use the same database for development and production?
@jcmbisa4241
@jcmbisa4241 2 жыл бұрын
handsome, smart, and well rich too, man many thanks 😀😀
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
You're welcome!
@joemusya2529
@joemusya2529 2 жыл бұрын
Found this video in the right time💯💯🤗😊
@NoajmIsMyName
@NoajmIsMyName Жыл бұрын
Tony. Tony. Tony. You are awesome!
@TonyTeachesTech
@TonyTeachesTech Жыл бұрын
Thank you kindly
@johnsolly
@johnsolly 2 жыл бұрын
What a solid video. Thanks! I just implemented these changes on my site!
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Glad it was helpful John!
@mahdidaoud
@mahdidaoud 3 жыл бұрын
Can you please explain the SECURE_PROXY_SSL_HEADER setting what it does for the django project and how to set it
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I have not used this one before, but here is the docs on it docs.djangoproject.com/en/3.2/ref/settings/#secure-proxy-ssl-header
@pabloxD75
@pabloxD75 3 жыл бұрын
What a great video with a great recommendations, thank you
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You are so welcome!
@truefugazi
@truefugazi 7 ай бұрын
So I am having issue, I hosted my project with render with a DB SQLite and when ever I update a listing in my admin after a few hours it resets/removes my listing I can’t seem to find my way around this please help
@codepen2035
@codepen2035 2 жыл бұрын
Brother when I enable debug=False Static file not working? Please help me. I am using VPS hosing with centos 7
@nitensapkota8606
@nitensapkota8606 2 жыл бұрын
Subscribed 🙌 can please make a video on how to access static files if you're hosting static files in digital ocean spaces ...i have hosted my static files in digital ocean spaces and I am not able to change anything on those files ..i have search online about it but they says AWS S3 is not mutable i have to download the files and edit the hosted file and then re-upload it which is not convenient ..
@ingermanpaez8449
@ingermanpaez8449 3 жыл бұрын
I am so grateful. God bless you son.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I'm happy to help :)
@joelmiruni8660
@joelmiruni8660 3 жыл бұрын
Brief and Straight to the point. Thanks. How could i solve this error: [Errno 99] Cannot assign requested address while registering users via email confirmation. Everything seems to work fine in development.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Hi Joel, I'm not familiar with that error. Sorry
@mukibulhasan
@mukibulhasan 3 жыл бұрын
nice information bro
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Thanks :)
@rsnor1425
@rsnor1425 2 ай бұрын
Good work! Please, make a tutorial to full deploy in Namecheap hosting... they have an strange way to serve static files for Admin panel
@Slickjitz
@Slickjitz 3 жыл бұрын
Wow this was super helpful, thanks!
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Glad it was helpful!
@enriqueuzcategui6057
@enriqueuzcategui6057 2 жыл бұрын
Hey Tony! Thanks for the video! I have a problem with a Django deployment, how can I hide the "Server" header? It's something i am being asked to do but I don't seem to find a way to hide/remove it. Thank you!
@bronaxcorps4243
@bronaxcorps4243 Жыл бұрын
Hey how can I separate my development database from my production database??
@ricosun
@ricosun 3 жыл бұрын
I was wondering what is the purpose of the secure key and why we need to hide it. Also what about the database connection string? Should we hide that as well ?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You can see the official documentation for these values here docs.djangoproject.com/en/3.2/ref/settings/#secret-key
@ricosun
@ricosun 3 жыл бұрын
@@TonyTeachesTech Cool Thx
@andresdemillos01
@andresdemillos01 2 жыл бұрын
Un muy buen video felicitaciones por tu trabajo es un canal muy vacano de seguir (Y)
@anindyabhattacharya4878
@anindyabhattacharya4878 4 жыл бұрын
precise content man.. good job.
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
Appreciate it!
@raveena.sharma
@raveena.sharma Ай бұрын
What about DB, since on production MySQL or Postgre is there.
@MrSiamtea
@MrSiamtea 3 жыл бұрын
I have a problem in reading env variables from ubuntu server. I can hide the credentials to environment just fine in devlopment as well as production. But the trick is my django app cannot retrieve that env keys in production. I'm missing something. I am searching for solutions, still searching for it. I'm not a great programmer, but I don't think this is hiding the secret key. It just relocate the key to a text file which is in the same directory as the app itself. How is that hiding? I'm confused.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Hmm, I'm not sure how to help you with this.
@G-3-A-R-Z
@G-3-A-R-Z 3 жыл бұрын
Why not a secret key in an .env? Coming from the JS world just a few weeks ago. Noticed they used a similar system.
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
That's an option for sure
@Alex-hp9no
@Alex-hp9no 2 жыл бұрын
hi, Im having trouble with media files, when I turn debug=True, then all of user added images shows on the page, and when i turn it False, it says the image is not found.. usual configurations in settings.py: STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "static/") MEDIA_URL = "/media/" MEDIA_ROOT = os.path.join(BASE_DIR, "media/") and also urls: url.. = [ ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) pls help me out here
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
Appreciate the code snippet. I would look at the URL of the image that's not found and compare that to the path on your filesystem
@navidazimi7816
@navidazimi7816 3 жыл бұрын
Thank you so much this was so useful 🙏🏻 Btw,I’m trying to serve my media files from a file hosting service that is connected to my main domain as a sub domain. I don’t know how should i tell Django to upload video files(inside media) to the other host.. Any help will be appreciated🙏🏻 Thank you so much🙏🏻
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Thanks! Sorry I don't have experience with Django uploads
@Goodforyouliving
@Goodforyouliving 3 жыл бұрын
When I change DEBUG=False all my media files (images) are not showing up? What is the correct way to make this work ?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
I don't know why that is happening
@BlueBrendan2000
@BlueBrendan2000 3 жыл бұрын
You've probably figured this out by now but I'll just leave this for anyone who may stumble upon this. I ran into this issue and spent hours looking for a fix 1. I wrote the src attribute for all my image elements with a hardcoded path (src="/images/somewhere/something.png"). In the official docs, it says to use the static template tag {% static "image path" %}. The static module can contain EITHER a string or a template variable but NOT both, so if you need that functionality then you'll have to create a custom template filter to append the strings together (the add filter didn't work for me). If you don't, then you can skip to step 2. There's an answer describing how this is done on stackoverflow (appending template variable in static TAG). An example of this is if the directory you need is /static/images/files/filename.png, and filename.png is stored in template variable {{ filename }}, the code you'll need in your html file will look like this {% with 'images/files/'|customfiltername:filename as variable_name %} {% endwith %} customfiltername is what performs the concatenation of 'images/files' with the contents of filename (again, this filter does not exist and needs to be written by you). As a note, make sure you include {% load static %} and {% load *name of the file that contains your custom template filter %} at the top of each file that contains an image 2. I messed up the static paths in my settings dot py file: there's STATIC_URL (the directory of the main static folder), STATICFILES_DIR (provides directory for static files in individual apps that are outside the main static folder), and STATIC_ROOT (used only when DEBUG=False). STATIC_ROOT exists because in production, Django doesn't serve static files from individual apps the way it does in production, so it bundles them all together in a single location. STATICFILES_DIR and STATIC_ROOT can't have the same name, so I used a folder called staticfiles to be used solely for production (static is the name of my main static folder used in development). To set your STATIC_ROOT directory, choose a directory name (I chose staticfiles), add the setting to your settings file, create an empty folder of the name you chose in the root folder of your project, and run the command "python manage dot py collectstatic". This will automatically traverse all the static files in your project and add them to the folder you chose in STATIC_ROOT Once I made these changes (added STATIC_ROOT to the settings, created the corresponding folder, ran the collectstatic command to populate it with files, and changed the source of all images in my project to use the {% static %} template tag), the images finally showed up as expected with DEBUG=False. I really hope this helps!
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
@@BlueBrendan2000 This will surely be helpful for others. Thanks!
@jayeshkarkare9334
@jayeshkarkare9334 4 жыл бұрын
Grt work bro,thnx a lot
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
You're welcome!!
@dscreats
@dscreats 4 жыл бұрын
i got this error how to resolve with open (os.path.join(BASE_DIR, 'SECRET_KEY.text')) as f: SECRET_KEY = f.red().strip() AttributeError: '_io.TextIOWrapper' object has no attribute 'red'
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
No attribute 'red'? That would be a syntax error... red -> read
@ethanroman6883
@ethanroman6883 4 жыл бұрын
Great video, keep going
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
Thanks, will do!
@kunalkashyap100
@kunalkashyap100 3 жыл бұрын
If I make these changes while my website is running on the server, do I need to restart the uwsgi service after making these changes or not?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
It would be a good idea
@toluwanimiadeyemo8099
@toluwanimiadeyemo8099 3 жыл бұрын
Great video! Thanks But how do I hide my database details, email details What about using .env file?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Yes you can use an env file that's above of the root of your website
@manuponot5093
@manuponot5093 3 жыл бұрын
Hello I have my website on production on Digital Ocean. My settings.py file has the Debug = False. I ran systemclt restart gunicorn command but nothing changed. However, I see the the page as if it was in Debug Mode. Please, how I can fix this issue ?
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Could this be a browser caching issue? Have you tried incognito or a guest window?
@manuponot5093
@manuponot5093 3 жыл бұрын
@@TonyTeachesTech My problem is solved thanks
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
@@manuponot5093 What that the issue?
@manuponot5093
@manuponot5093 3 жыл бұрын
​@@TonyTeachesTech It was my fault I have created a config file local_settings.py and didn't remeber that it exists and it was Debug = True inside
@daniellloyd5584
@daniellloyd5584 2 жыл бұрын
Thank you!
@TonyTeachesTech
@TonyTeachesTech 2 жыл бұрын
You're welcome!
@enzopascucci9933
@enzopascucci9933 3 жыл бұрын
After setting hsts setting i couldn't been able to run on localhost to changes anything
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
You'll need to clear HSTS settings for your website from your browser really-simple-ssl.com/knowledge-base/clear-hsts-browser/
@enzopascucci9933
@enzopascucci9933 3 жыл бұрын
@@TonyTeachesTech it didn't worked, but worked with the package django-sslserver
@saudzubedi
@saudzubedi 3 жыл бұрын
My site just doesn't work after adding SECURE_SSL_REDIRECT=True, this is the error: "You're accessing the development server over HTTPS, but it only supports HTTP." Some help would be nice :)
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Are you launching your site using the runserver command? If so, that's your problem. These settings are for production servers kzbin.info/www/bejne/kKG1Yopjg7yhppY
@thebewerter5730
@thebewerter5730 3 жыл бұрын
Cool, thanks!
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
No problem!
@viveksharmapec7637
@viveksharmapec7637 4 жыл бұрын
thanks bdy
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
Sure thing 🙂
@alexi_space
@alexi_space 2 жыл бұрын
after set SECURE_SSL_REDIRECT = True I always get: True page isnt redirecting properly ...
@rounakchourasia2030
@rounakchourasia2030 3 жыл бұрын
That intro after that calm voice! I was on 80% volume! :(
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Woke you up, didn't it 😉
@xpert9001
@xpert9001 4 жыл бұрын
Nice.
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
Thanks!
@henrim9348
@henrim9348 4 жыл бұрын
Great video. Thanks a lot. What production environment do you deploy to? GCP?AWS?
@TonyTeachesTech
@TonyTeachesTech 4 жыл бұрын
Right now, I'm on Linode
@YadavDheeraj2000
@YadavDheeraj2000 2 жыл бұрын
Abe Bhai kya bta rha
@SamSam-e5c
@SamSam-e5c 7 ай бұрын
horrible sizer inducing intro. more so at 2x speed. video content is good though.
@balajishetty
@balajishetty 2 жыл бұрын
Excellent tutorial. Can you give expert lectures in our college on Django . Whatsapp Me
@BikiniGyat
@BikiniGyat 3 жыл бұрын
Awesome! Thanks a lot!
@TonyTeachesTech
@TonyTeachesTech 3 жыл бұрын
Sure thing!
@jvsydroyrakotonomenjanahar8324
@jvsydroyrakotonomenjanahar8324 Жыл бұрын
Thank you!
How to Deploy Django on Nginx with uWSGI (full tutorial)
37:57
Tony Teaches Tech
Рет қаралды 93 М.
Django: Managing Development and Production Settings.
19:42
Code With Clinton
Рет қаралды 3,7 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
django Architecture - Connection Management
15:10
Hussein Nasser
Рет қаралды 51 М.
Coding a Web Server in 25 Lines - Computerphile
17:49
Computerphile
Рет қаралды 350 М.
Deploying Django with Gunicorn & Nginx: Step-by-Step Tutorial! 🔥
17:40
How to Render Django Templates with HTML
12:04
Tony Teaches Tech
Рет қаралды 8 М.
Deploy a Django web app to Vercel [FREE]
18:21
Cloud With Django
Рет қаралды 87 М.
How to deploy a Django project with DigitalOcean
31:47
Matt Freire
Рет қаралды 90 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН