Thank you, this is very helpful for leveraging the power of both vue and django. One question: Does localstorage leave a security vulnerability since the user can modify its state?
You're welcome 🙂 If you just used local storage (as in the local storage on the browser) you might create a security issue that you'd need to handle. However, we don't do that in the guide. In the guide, we use: 1. session storage. This sets a httpsecure cookie that only servers can modify (e.g., we make a request to Django from vue to set it, but vue can't access it. 2. csrftoken. This is a random token that django sends to vue to check that only ouor intended site (our vue app) is accessing Django. Vue can access this, but django is expecting a certain csrftoken back. The csrftoken contains no sensitive data and changing it would cause django to throw an error.
Have been using django ninja for some time now, it really is an amazing way to build API's. My weakspot has always been frontend, so now I'm trying to shore up my experience with JS technologies (mainly react, since its the only framework I've spent any real time on). Thanks for the awesome video, keep it up! More people need to know about Django Ninja 🚀
Cool question. To avoid removing the csrf except is possible but depends on what Google allows. Django generates the csrf token and then Google sends a request to Django. So to keep using that csrf token, you would need to send the csrf token to Google and then have Google also send that csrf token when it sends a request to auth receiver. So check out the Google docs to see what Google allows and let me know. One thing to note: This will add significantly higher complexity beyond the tutorial.
Hi Anzil. I’m not going to post the source online due to the effort required to separate it from Photon Designer. However, feel free to copy the page source from your browser! You should be able to replicate it that way.
Hi Tom, thank you for this great video, found out that its not working in Firefox though due to a bug a in Firefox prevents it from loading source maps for WebExtensions (discovered when trying to log in)
Alpine.js is great! I wanted to use React here for the situation where you need a much more robust frontend. Alpine is great for embedding in a backend that serves HTML. But, in this instance, I am using Django Ninja to return JSON, so Alpine wouldn't be the right choice. Let me know if you've any more questions.
@@tomdekan thanks for your reply... i couldn't understood the part of stability 😅, because alpine.JS didn't use vDom, while react does :) alpineJS works similiar like vue, but faster and leighter, it also fetch API, it's whole x-data based on API... or did i missunderstood your point?
Almost! Some benefits of React v Alpine are: - it handles higher complexity more easily. For example, There are neat ways to put React code in components and handle lifecycle. This is strongly advantageous after you pass a certain complexity. - React has many more packages and support. This means you can do certain things much faster because other people have already written great packages for you, eg React Framer Motion.
Hey Tom, attempted to find an email to reach out but wasn't able to but it looks like you respond to most comments so I'm hoping this message reaches you. I've been working on a Django, ninja, corse, all auth authentication system for a while. Currently in production I have a mobile first docker container which runs a flask app for mainly hosting the dash framework and on the backend I have that Django application also wrapped in a docker container with all I had mentioned. I've been trying to setup authentication from my flask server into my Django server remotely for users but I've ran into a few issues and resolved many others. Noticed a lot of comments in your ninja video are people interested in a video of how to set up authentication via ninja. I've also seen some of your prior work with authentication and read some of your other articles of similar nature. Your really talented, I'm recently getting back into making videos after a two years absence and am in the programming industry. Just wanted to reach out as I think we could help each other, have some initial code for this ninja authentication system Id like to get an opinion on and maybe we can find a place for us to collaborate on building a useful tutorial for the Django community. Reach out if your available or interested, would like to talk more. pipinstallpython@gmail.com, reference dash.geomapindex.com, geomapindex.com, piratesbargain.com and github.com/pip-install-python
Amazing, freshly baked 2 months ago. Needed it for a company project where we run some automatic script in the background when new task arrived. Thank you! Also benefited a lot from your google login video.(Although I had a GSI_LOGGER error, I saw some commented on your original video which is still not solve, so I am using the old google login API at the moment).
Awesome - great to hear 😊 On the Google login video, I updated the written guide 2 days ago to fix the GSI_LIGGER error (Google no longer allows redirect with Django). Check out the link in the Google video!
This library is not safe. IT broken (shut down) my application in production. Be aware. After I install it no comande works in terminal anymore. I can't solve it. I trying hard
Hi Paulo. I'm not sure what you meanby "not safe" here. The package that I'm using is the official Google python package - I'm pretty confident that it is safe!
Hi Tom, thank you kindly for this video. I was wondering if you could talk about two topics: - Auth considerations with django ninja. Common security pitfalls especially. - A walkthrough of deploying django to prod. Thanks!
Thanks, been struggling for this the entire day, until your video. It made sense. I had 2 x-csrftokens, that's why it didn't work. Also apparently there's a difference between axios, fetch and axios.get vs axios({method: 'get' } ) ... The method:' get' verison works the other doesn/t
Hey this is a great tutorial! I was able to follow along up until the part where we needed to edit the views file. The lines from google.oauth2 import id_token, from google.auth.transport import requests were giving me an error where it said that google.oauth2 and google.auth.transport could not be resolved by pylace. I'm assuming that I need to download these modules or something like that but I'm not able to find the right commands to do this. I'm currently coding on VS code on a mac book. I would really appreciate it if you could help me out :) thank you!
Hey! I actually figured out how to fix that issue, thank you! however I'm running into another issue where, when I click the sign in with google button on the sign_up page, it takes me to a blank document - not sure what's going on :(
Thanks Sahana. I've just looked into this today, found the problem, and fixed it. Google now doesn't allow the redirect option in the local dev environment. You'll just need to: 1. Change your HTML code to use "popup" rather than redirect 2. Add the two lines I mention in the settings.py file to allow popups to redirect to Django. 👉 See the full instructions in the updated article: www.photondesigner.com/articles/google-sign-in?ref=yt
Honest question from newbie developer. I use rsync to push my project to the VPS, and then run docker compose up. Site is deployed in seconds. Admittedly it took awhile to work out the Dockerfile and the Caddyfile details and to initially install Docker (Snap), but once that’s settled, it seems as easy as using a PAAS service? What am I overlooking?
Thanks for the question and glad that your setup is working well. The two main costs are: 1. setting up infrastructure (which you've already paid), and 2. maintaining your infrastructure (which you'll continue to pay). There will likely be issues in the future, e.g., Docker will need updating, something will fail in your setup, etc., (hard to predict now). With your setup, you'll continue to pay the costs of being the infrastructure engineer in charge of this. For me, I'd rather outsource this to a paid service, and maximise the time I can spend building product / adding customer value, rather than maintaining infrastructure. For you, I'd recommend not worrying about this point now that you've set up your infrastructure. I'd recommend that you focus on building things that add value to your users instead 🙂
Hi Alex - yeah absolutely. There’s a big “if” on this video. There are lots of places where $7 is too much. My general suggestion is for developers not to prioritise spending time over money, where they can afford to do so.
Hey man! This tutorial is perfect RIGHT ON THE MONEY for this topic. THANK YOU very much for taking your PERSONAL TIME to make these videos! PS! At this fucking JUICY and EPIC level that the actual content of your video is, things like mic-quality, audio compression, and (meh) maximizing UI-space for us poor short-sighted people are the only things I can think of making this a 9.8 / 10. Well played, sir! All the best <3
You're welcome 🙂 And thanks a lot for that feedback! I've upgraded mic-quality, audio compression, and UI-space in my recent videos. Glad to hear that the content was good enough for the low-quality of these things in this video. Let me know if you've got any other suggestions 🙂
great tutorial would love to see the second part. If anyone is getting an error """ Import "django.db" could not be resolved from sourcePylancereportMissingModuleSource (module) django """ Then the problem is that you have to create your virtual enviornment before deploying django, you would need to do python -m venv venv source venv/bin/activate in the terminal and then the deployment part
Both are good. I prefer Vue, but React has more features and libraries. For getting a job, I'd say that learning React is slightly more helpful, as many more people use it.
You're welcome. I've just posted the written guide here (including auth, but not yet production): www.photondesigner.com/articles/react-auth . Video coming soon 🙂
@@its-cess Thanks Cess! The written guide for part 2 is here: www.photondesigner.com/articles/react-auth I plan to release the video in the next week or so.
Well the code part is similar to using the Response of DRF and thus removing the need for a serializer... Doesn't look like a stellar upgrade to get to or am I missing something here?
There are quite a few nice Django Ninja features v DRF: check out this Jayesh: django-ninja.dev/motivation/ I probably wouldn't switch from DRF to Ninja if I was using DRF. But I would start all new Django APIs with Django Ninja
@@tomdekan Please help to create a tutorial on how to build a system that can detect similarities between thesis titles. The aim is to help identify thesis titles that are similar or may be duplicates at an educational institution.🙏