Login With User Authentication - Django Wednesdays #21

Поділитися
Вставка
  • Опубліковано 21 лип 2024
  • In this video we'll start to build out the user authentication system by creating a login page.
    Django comes with a pretty nice user authentication system that we'll tap into and use for all of this.
    First we'll create a new 'members' app to hold all of our authentication stuff. Then we'll create a login page that allows users to log in.
    #django #codemy #JohnElder
    Timecodes
    0:00​​ - Introduction
    2:27 - Create New Members App
    3:00 - Add Members App To Settings.py File
    3:37 - Add URLS.py file to Members App
    4:40 - Add New URL Paths to Old URLS.py file
    6:14 - Add Templates Directory To Members App
    6:30 - Create Login.html Page
    7:26 - Import Authentication to Views.py
    8:06 - Add Login_user View
    9:14 - Add Login Link To Navbar
    9:40 - Add Login URL Path
    10:25 - Add Login Form to Login.html
    12:13 - Check Django Authentication Docs
    13:00 - Add Login Code to View
    17:51 - Add Messages To Base.html
    18:44 - Add Bootstrap Style To Messages
    19:20 - Test Everything
    20:00 - Conclusion

КОМЕНТАРІ • 132

  • @Codemycom
    @Codemycom  3 роки тому +5

    ▶️ Watch Entire Django Wednesdays Playlist ✅ Subscribe To My UA-cam Channel:
    bit.ly/35Xo9jD bit.ly/2IGzvOR
    ▶️ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
    ▶️ Get The Code
    bit.ly/3sJpeV6

  • @toast_on_toast1270
    @toast_on_toast1270 2 роки тому +19

    Very good series this is FAR better quality than what is offered from my CS course! FYI for anyone like me using current Django version in 2022 (around 3.5 I think), the view for login will only work when the templates subfolder is called 'registration', not 'authenticate' or anything else. Too much of a beginner to know why this is, or even if it's just a mistake on my part. That's what i'm here for! Thanks again!

    • @Codemycom
      @Codemycom  2 роки тому +1

      Glad you're enjoying the videos!

    • @zuberkhan-kn7iu
      @zuberkhan-kn7iu Рік тому

      Thanks for the heads up, i was stuck here.

    • @paulbrugger9610
      @paulbrugger9610 Рік тому +1

      I am using Django 4.1.4 and I can use a templates/authenticate folder with no problem....

  • @teekumar5056
    @teekumar5056 2 роки тому +1

    Thanks John! Feel very lucky to have found your videos!!

  • @CodeWithClinton
    @CodeWithClinton 3 роки тому +6

    Thank you so much, your tutorials are helping me to teach my students better on YT. 🙏🙏

  • @coderroy290
    @coderroy290 2 роки тому

    Hello John I have a question that at 9:52
    i am using path('login/', views.login_user, name='login') and it is giving error
    but using path('login_user/', views.login_user, name='login') does not give error
    why?

  • @yunasan8755
    @yunasan8755 2 роки тому +1

    Is it okay to put admin and users (people who use the website) together in Users table/models? thanks for the video!

  • @__bracer__
    @__bracer__ 2 роки тому

    You are an amazing teacher and probably a dev! Thanks.

  • @yasayah7289
    @yasayah7289 2 роки тому

    Great tutorial! If you want to restrict access to friends, how can you require users to be approved by admin before they can have access?

  • @hndr91
    @hndr91 2 роки тому

    Thanks John, very clear and compact explanation 👏 I don't even even get this material on paid course, meh

    • @Codemycom
      @Codemycom  2 роки тому

      Feel free to head over to codemy.com and give me money lol

  • @funnytech2646
    @funnytech2646 8 місяців тому

    i am using firestore database
    this method is suitable it?

  • @rushikeshshete6885
    @rushikeshshete6885 2 роки тому

    How can we add that messages code in login.html file

  • @dsyoutube7116
    @dsyoutube7116 3 роки тому +12

    I mean really, now I feel like I'm learning Python fun with Walter White. Surely you look like him. I love the channel 😍

  • @sergejg4773
    @sergejg4773 Рік тому

    Top video. Thank you so much.!!!!! Great lesson

  • @sanketkumar_coder
    @sanketkumar_coder Рік тому

    How to use this functionality to authenticate database fields authentication

  • @peterm9893
    @peterm9893 Рік тому

    Big love, not just like .. awesome work, hats off mate!!

  • @mohammadg5326
    @mohammadg5326 3 роки тому

    I just wanted this video and you provided it. thanks

  • @rubanlesliej4055
    @rubanlesliej4055 3 роки тому

    Thank you John for the videos. Highly informative. Could you please post video/articles on how to create time slots selection in django forms?

  • @danatheriot9650
    @danatheriot9650 Рік тому

    Hello, I am working through all your tutorials and everything was going great until I got to this video and my Login_user errors with "AttributeError at /members/login_user
    'tuple' object has no attribute '_meta'". I have gone through and double check to make sure I did not misspell or forget something but I can not find it??? I am using Django 4.1.3 version on an apple computer? Any suggestion would be greatly appreciated! I so thoroughly have been enjoying your tutorials.
    On a different note: Where can I find a video tutorial that covers how to change the "home" page calendar from what Wednesday #2 created to having it in conjunction with all of the events and venues date; have each date link to the event and/or venue????

    • @Codemycom
      @Codemycom  Рік тому

      I suggest you put the code aside for a couple days and then come back and rewatch the video. The error you made will likely jump right out at you then, once you have a fresh set of eyes to look at it.

  • @imanerahmaoui04
    @imanerahmaoui04 3 місяці тому

    Thank you soo mucch, this was soo helpful you saved my time ❤

    • @Codemycom
      @Codemycom  3 місяці тому +1

      Glad to hear it!

  • @MariMuthu-lk3qb
    @MariMuthu-lk3qb Місяць тому

    Thanks buddy ,I feel happy 🎉

  • @thomasyoung9161
    @thomasyoung9161 2 роки тому

    I don't seem to be getting an error message when using invalid login details - it still redirects me to the homepage as though the credentials were those of a valid user - any ideas?

    • @Codemycom
      @Codemycom  2 роки тому

      No clue, check your code vs mine and see what you did wrong.

  • @mikewooldridge3224
    @mikewooldridge3224 2 роки тому

    Very helpful, thanks.

  • @magallonseancarl4061
    @magallonseancarl4061 Рік тому

    Hey John, I was wondering how can I make the login method check the users'(not the admin's) username and password instead?

    • @Codemycom
      @Codemycom  Рік тому +1

      It does that by default, of course is checks whoever is logging in at the time.

  • @jakobmusic9187
    @jakobmusic9187 Рік тому

    thanks for the tutorial. a bit of constructive feedback though: for me the text could be a bit smaller.

  • @labialkosta261
    @labialkosta261 3 роки тому

    I send you a email about multi users website and so funny you said you can't help me with this that project but you did answering me here in thiq video hhhh man you're awesome i thought you did this video for me thanks anyway

    • @Codemycom
      @Codemycom  3 роки тому

      glad it was useful!

    • @codewithguy9373
      @codewithguy9373 3 роки тому

      Hey what's codemy.com email?

    • @Codemycom
      @Codemycom  3 роки тому

      @@codewithguy9373 At the top of any page of the site there's a contact form where you can send me a message.

  • @user-mh6ek3hv3k
    @user-mh6ek3hv3k Рік тому

    thank you for the video although i have a problem. My error message does not show but i did everything the way you did in the video...any clue as to why?

    • @Codemycom
      @Codemycom  Рік тому

      Sorry, I don't know what you mean by your "error messages does not show".

  • @nicolasalegria6526
    @nicolasalegria6526 Рік тому

    great, english tutorials are the best

  • @buddyftv4628
    @buddyftv4628 2 роки тому

    Sir! Can you please create a video regarding Django Login with email and password

  • @umeshpurohit5252
    @umeshpurohit5252 3 роки тому

    Great Sir! Thanks

  • @infinitespace1982
    @infinitespace1982 8 місяців тому

    Hi John! I'm in a bit of a pickle here. Lately I've noticed that all of the urls that pass either 'venue_id' or 'event_id' as a parameter always invoke the home function for some reason, even though the urls are mapped to each separate individual function. I've tried researching a solution or at least a cause for this, but nothing has helped.

    • @Codemycom
      @Codemycom  8 місяців тому

      It can only happen because you coded it to do that. Check your link, and your urls.py one of them is pointing to home. Or the function in views.py points home.

    • @infinitespace1982
      @infinitespace1982 8 місяців тому

      @@Codemycom hi, thanks for your reply, I have rechecked everything and even compared it to your code, but there are no logical errors, and all urls have been defined and called correctly. I’ve also checked the views file as well.

    • @infinitespace1982
      @infinitespace1982 8 місяців тому

      @@Codemycom these tutorials for now are using diango 3.0 and I’m using 4.0. I am aware the urls template is the same, but maybe the syntax for adding additional arguments may be different?

  • @abdullahmekki4386
    @abdullahmekki4386 Рік тому

    I dont understand how authenticate function authenticate user I mean where it looks to ensure it is authenticated user or not

    • @Codemycom
      @Codemycom  Рік тому +1

      Django has the functionality built into it.

  • @gretabaliunaite1026
    @gretabaliunaite1026 Рік тому

    Love the intro :)

  • @itsumair001
    @itsumair001 Рік тому

    Hello Sir I have printed username and password in console its entered as same in database but still it returned none and cannt autorized the user

    • @Codemycom
      @Codemycom  Рік тому

      You mistyped something in your code then. Rewatch the video and try to discover what.

  • @sicness0
    @sicness0 Рік тому

    Thanks, but I have an issue in 17:21. My terminal says "Not found /members/POST"

    • @Codemycom
      @Codemycom  Рік тому

      what did you do differently from the video?

    • @sicness0
      @sicness0 Рік тому

      @@Codemycom I'm working in a project that belongs to another person, but I did everything the same way as you tell in the video. Maybe there's something in another part of the project

  • @deki90to
    @deki90to 3 роки тому

    Enjoyable video!

  • @user-mv6jx4on6z
    @user-mv6jx4on6z 8 місяців тому

    Which program did you use to code that you've coded for 22 minutes ? write the name please

    • @Codemycom
      @Codemycom  8 місяців тому

      Say pretty clearly at the beginning of the video that it's Sublime Text and the Git bash terminal.

  • @acronproject
    @acronproject Рік тому

    Verygood

  • @svetoslavastoyanova1803
    @svetoslavastoyanova1803 3 роки тому

    Where can I find your courses? And please can u tell me what is an extended Django user? I find your explanations better than the people's in my academy...

  • @rokibulhaque1673
    @rokibulhaque1673 Рік тому

    Hi, i am following your tutorial regularly...Its amazing. Do you have any tutorial on " django app hosting using IIS" or can you please make one to put dhango project in production...

    • @Codemycom
      @Codemycom  Рік тому

      No, I would never use IIS for django.

  • @Draculinio
    @Draculinio Рік тому

    Saved my weekend!

  • @yadneshdalvi2043
    @yadneshdalvi2043 3 місяці тому

    What if we want to make multiple logins?

    • @Codemycom
      @Codemycom  3 місяці тому

      I don't know what that could possibly be

  • @user-vx8co7mv2s
    @user-vx8co7mv2s Рік тому

    Hello sir
    can we do the user authentication with email instead of username

  • @Leo-gz8us
    @Leo-gz8us Рік тому

    Very helpful video

  • @yamilaq
    @yamilaq Рік тому

    I think I will adopt you... You are my savior

  • @zainulhassan9186
    @zainulhassan9186 3 роки тому

    How to Add 2-Step-Verification To This Login Page ?

    • @Codemycom
      @Codemycom  3 роки тому

      I don't have any videos on that

  • @vasanthvassu643
    @vasanthvassu643 10 місяців тому

    Tell me what is the good approach while working with authentication
    Using the way what u said
    Or else Can I use LoginView , LogoutView classes

    • @Codemycom
      @Codemycom  10 місяців тому

      Sorry, no idea what you're asking.

  • @baptistaguivala4791
    @baptistaguivala4791 Рік тому

    Good afternoon, I have a problem with my code in python django, can I share it with you to help?

    • @Codemycom
      @Codemycom  Рік тому

      Sorry, I don't do any consulting.

  • @omidabdolvand2458
    @omidabdolvand2458 2 роки тому

    highly greate💥

  • @SpurHub
    @SpurHub Рік тому

    Thanks man

  • @ishak099
    @ishak099 2 роки тому

    thanks a lot sir

  • @angeliecampaner9471
    @angeliecampaner9471 Рік тому

    Thanks a lot

  • @viratraj194
    @viratraj194 Рік тому

    Sir can you please make a video for separate manager login or for separate manager user identification please 🙏🏻

    • @Codemycom
      @Codemycom  Рік тому

      Sorry, this series is finished.

  • @gabrielhernandez2338
    @gabrielhernandez2338 2 роки тому

    Can i login with a normal user ?

  • @zainulhassan9186
    @zainulhassan9186 3 роки тому

    (" How to Add 2-Step-Verification To This Login Page? ") - Can You Upload a Video For This ?

    • @Codemycom
      @Codemycom  3 роки тому

      Might do that eventually

  • @saikiran9185
    @saikiran9185 2 роки тому

    If I buy your courses , what is the validity?

    • @Codemycom
      @Codemycom  2 роки тому

      Validity? No idea what you're talking about

  • @elishatech4600
    @elishatech4600 Рік тому

    How do you host a Django website

    • @Codemycom
      @Codemycom  Рік тому +1

      codemy.com/push-django-python-apps-heroku-web-hosting/

  • @sonalisharma1854
    @sonalisharma1854 2 роки тому

    can you please provide the code for this video

    • @Codemycom
      @Codemycom  2 роки тому

      It's in the pinned comment as always

  • @ihandjikanasser3713
    @ihandjikanasser3713 Рік тому

    Respect 👍

  • @sanskarkakde2552
    @sanskarkakde2552 Місяць тому

    Where is models?

  • @ayushtripathi7985
    @ayushtripathi7985 3 роки тому

    Sir I like your videos can you plz upload all your codemy courses on youtube for free because I love your way of teaching.

    • @Codemycom
      @Codemycom  3 роки тому +1

      Thanks...no, I won't be doing that :-p

  • @Nathan-zc1qs
    @Nathan-zc1qs 2 роки тому

    did anyone see the whatsupp guys at the begiinig kkkkkk

  • @shishirsapkota1483
    @shishirsapkota1483 2 роки тому

    Walter white 2.0

  • @lan_network5473
    @lan_network5473 Рік тому

    xersi glo

  • @seforaabigail6704
    @seforaabigail6704 2 роки тому

  • @Charoiz
    @Charoiz Рік тому

    username = request.POST['username']
    Didn't work for me, but
    username = request.POST.get('username')
    Worked.
    And the same with password.

    • @sicness0
      @sicness0 Рік тому

      neither of both solutions worked for me. I have: "Not found/members/POST"

    • @piotrpoletek2525
      @piotrpoletek2525 Рік тому

      I've got the same issue and I can login anly as admin. Anyone solved this?