1:32 - As for the secret key, also recommended to check the module 'decouple'. It does the same thing but in more elegant way.
@TonyTeachesTech2 жыл бұрын
Thanks for the tip Daniel
@ChiragVora2 ай бұрын
Or dotenv. Modules like these also help to hide other credentials like database name password and username etc
@EvaLindner-v7v9 ай бұрын
Clear, concise, competent and to the point. Thank you!
@TonyTeachesTech9 ай бұрын
You're welcome! Subscribe for more :)
@markwollert5653 жыл бұрын
Dude, I'm so grateful to you for the work you've done on all of your videos
@TonyTeachesTech3 жыл бұрын
I appreciate that!
@jvoynar5826 Жыл бұрын
Very nice, thank you!
@vectoralphaSec9 ай бұрын
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.
@anselsolomon62703 жыл бұрын
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
@TonyTeachesTech3 жыл бұрын
Probably not postgres but I will consider a Django email tutorial :)
@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 Жыл бұрын
🙏🙏🙏
@krzysztofszumko90804 жыл бұрын
Great Video! Straight to the point, no time wasted just awesome :). Keep up the good work.
@TonyTeachesTech4 жыл бұрын
I appreciate that 😊
@MadaMediaproduction2 жыл бұрын
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
@TheLolcheater2 жыл бұрын
Best Tutorial i have ever seen! Your Awsome!
@TonyTeachesTech2 жыл бұрын
Thanks!!
@cheesecakelover20783 жыл бұрын
This was an amazing video, learnt quite a lot of things which turned out to be very important! Thank you so much :)
@TonyTeachesTech2 жыл бұрын
Sure thing!
@KenoAlordiah3 жыл бұрын
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.
@TonyTeachesTech3 жыл бұрын
You're welcome Keno !
@shivamdubey47832 жыл бұрын
Great tutorial sir do we have to change the file upload settings also
@agresiv02 жыл бұрын
Is it best practice to use the same database for development and production?
@jcmbisa42412 жыл бұрын
handsome, smart, and well rich too, man many thanks 😀😀
@TonyTeachesTech2 жыл бұрын
You're welcome!
@joemusya25292 жыл бұрын
Found this video in the right time💯💯🤗😊
@NoajmIsMyName Жыл бұрын
Tony. Tony. Tony. You are awesome!
@TonyTeachesTech Жыл бұрын
Thank you kindly
@johnsolly2 жыл бұрын
What a solid video. Thanks! I just implemented these changes on my site!
@TonyTeachesTech2 жыл бұрын
Glad it was helpful John!
@mahdidaoud3 жыл бұрын
Can you please explain the SECURE_PROXY_SSL_HEADER setting what it does for the django project and how to set it
@TonyTeachesTech3 жыл бұрын
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
@pabloxD753 жыл бұрын
What a great video with a great recommendations, thank you
@TonyTeachesTech3 жыл бұрын
You are so welcome!
@truefugazi7 ай бұрын
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
@codepen20352 жыл бұрын
Brother when I enable debug=False Static file not working? Please help me. I am using VPS hosing with centos 7
@nitensapkota86062 жыл бұрын
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 ..
@ingermanpaez84493 жыл бұрын
I am so grateful. God bless you son.
@TonyTeachesTech3 жыл бұрын
I'm happy to help :)
@joelmiruni86603 жыл бұрын
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.
@TonyTeachesTech3 жыл бұрын
Hi Joel, I'm not familiar with that error. Sorry
@mukibulhasan3 жыл бұрын
nice information bro
@TonyTeachesTech3 жыл бұрын
Thanks :)
@rsnor14252 ай бұрын
Good work! Please, make a tutorial to full deploy in Namecheap hosting... they have an strange way to serve static files for Admin panel
@Slickjitz3 жыл бұрын
Wow this was super helpful, thanks!
@TonyTeachesTech3 жыл бұрын
Glad it was helpful!
@enriqueuzcategui60572 жыл бұрын
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 Жыл бұрын
Hey how can I separate my development database from my production database??
@ricosun3 жыл бұрын
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 ?
@TonyTeachesTech3 жыл бұрын
You can see the official documentation for these values here docs.djangoproject.com/en/3.2/ref/settings/#secret-key
@ricosun3 жыл бұрын
@@TonyTeachesTech Cool Thx
@andresdemillos012 жыл бұрын
Un muy buen video felicitaciones por tu trabajo es un canal muy vacano de seguir (Y)
@anindyabhattacharya48784 жыл бұрын
precise content man.. good job.
@TonyTeachesTech4 жыл бұрын
Appreciate it!
@raveena.sharmaАй бұрын
What about DB, since on production MySQL or Postgre is there.
@MrSiamtea3 жыл бұрын
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.
@TonyTeachesTech3 жыл бұрын
Hmm, I'm not sure how to help you with this.
@G-3-A-R-Z3 жыл бұрын
Why not a secret key in an .env? Coming from the JS world just a few weeks ago. Noticed they used a similar system.
@TonyTeachesTech3 жыл бұрын
That's an option for sure
@Alex-hp9no2 жыл бұрын
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
@TonyTeachesTech2 жыл бұрын
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
@navidazimi78163 жыл бұрын
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🙏🏻
@TonyTeachesTech3 жыл бұрын
Thanks! Sorry I don't have experience with Django uploads
@Goodforyouliving3 жыл бұрын
When I change DEBUG=False all my media files (images) are not showing up? What is the correct way to make this work ?
@TonyTeachesTech3 жыл бұрын
I don't know why that is happening
@BlueBrendan20003 жыл бұрын
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!
@TonyTeachesTech3 жыл бұрын
@@BlueBrendan2000 This will surely be helpful for others. Thanks!
@jayeshkarkare93344 жыл бұрын
Grt work bro,thnx a lot
@TonyTeachesTech4 жыл бұрын
You're welcome!!
@dscreats4 жыл бұрын
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'
@TonyTeachesTech4 жыл бұрын
No attribute 'red'? That would be a syntax error... red -> read
@ethanroman68834 жыл бұрын
Great video, keep going
@TonyTeachesTech4 жыл бұрын
Thanks, will do!
@kunalkashyap1003 жыл бұрын
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?
@TonyTeachesTech3 жыл бұрын
It would be a good idea
@toluwanimiadeyemo80993 жыл бұрын
Great video! Thanks But how do I hide my database details, email details What about using .env file?
@TonyTeachesTech3 жыл бұрын
Yes you can use an env file that's above of the root of your website
@manuponot50933 жыл бұрын
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 ?
@TonyTeachesTech3 жыл бұрын
Could this be a browser caching issue? Have you tried incognito or a guest window?
@manuponot50933 жыл бұрын
@@TonyTeachesTech My problem is solved thanks
@TonyTeachesTech3 жыл бұрын
@@manuponot5093 What that the issue?
@manuponot50933 жыл бұрын
@@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
@daniellloyd55842 жыл бұрын
Thank you!
@TonyTeachesTech2 жыл бұрын
You're welcome!
@enzopascucci99333 жыл бұрын
After setting hsts setting i couldn't been able to run on localhost to changes anything
@TonyTeachesTech3 жыл бұрын
You'll need to clear HSTS settings for your website from your browser really-simple-ssl.com/knowledge-base/clear-hsts-browser/
@enzopascucci99333 жыл бұрын
@@TonyTeachesTech it didn't worked, but worked with the package django-sslserver
@saudzubedi3 жыл бұрын
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 :)
@TonyTeachesTech3 жыл бұрын
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
@thebewerter57303 жыл бұрын
Cool, thanks!
@TonyTeachesTech3 жыл бұрын
No problem!
@viveksharmapec76374 жыл бұрын
thanks bdy
@TonyTeachesTech4 жыл бұрын
Sure thing 🙂
@alexi_space2 жыл бұрын
after set SECURE_SSL_REDIRECT = True I always get: True page isnt redirecting properly ...
@rounakchourasia20303 жыл бұрын
That intro after that calm voice! I was on 80% volume! :(
@TonyTeachesTech3 жыл бұрын
Woke you up, didn't it 😉
@xpert90014 жыл бұрын
Nice.
@TonyTeachesTech4 жыл бұрын
Thanks!
@henrim93484 жыл бұрын
Great video. Thanks a lot. What production environment do you deploy to? GCP?AWS?
@TonyTeachesTech4 жыл бұрын
Right now, I'm on Linode
@YadavDheeraj20002 жыл бұрын
Abe Bhai kya bta rha
@SamSam-e5c7 ай бұрын
horrible sizer inducing intro. more so at 2x speed. video content is good though.
@balajishetty2 жыл бұрын
Excellent tutorial. Can you give expert lectures in our college on Django . Whatsapp Me