Тёмный

Python Django Tutorial: Full-Featured Web App Part 7 - Login and Logout System 

Corey Schafer
Подписаться 1,3 млн
Просмотров 466 тыс.
50% 1

In this Python Django Tutorial, we will be learning how to create an authentication system for our application so that users can login and logout. We are also going to see how we can restrict certain pages so that users must be logged-in in order to access the page. Let's get started...
The code for this series can be found at:
github.com/CoreyMSchafer/code...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Python #Django

Опубликовано:

 

30 авг 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 610   
@ccandour
@ccandour 2 месяца назад
If you're using Django 5 or higher you will encounter the problem with accessing the 'logout' page directly from the browser like Corey does. This is because the logout endpoint can be accessed now only using a 'POST' method, and accessing it via a URL is using the 'GET' method. One of the ways you can resolve this issue is to add this short code snippet instead of the standard link element in the navbar: {% csrf_token %} Logout Doesn't look perfect but it works :) Hope this helps!
@GanaderIA-qv6fh
@GanaderIA-qv6fh 2 месяца назад
I was just running into this issue yesterday! Thanks!! Would like to see a way we can keep the anchor instead of having to use a btn though.
@tarik_el_oukili
@tarik_el_oukili 2 месяца назад
Thanks man
@SachiSisodia-lc6zj
@SachiSisodia-lc6zj Месяц назад
tysm!
@Incognito-rr5ic
@Incognito-rr5ic 18 дней назад
Thanks man.
@rishabhkumar5611
@rishabhkumar5611 5 лет назад
I love it how he says - " We'll fix that in just a second " and actually fixes it quite well in a second :)
@python4692
@python4692 3 года назад
He knows what he's doing!
@solomonjayceon1284
@solomonjayceon1284 2 года назад
i guess im asking the wrong place but does anybody know a way to log back into an instagram account..? I stupidly lost the login password. I appreciate any help you can offer me
@maximomohamed2909
@maximomohamed2909 2 года назад
@Solomon Jayceon instablaster =)
@solomonjayceon1284
@solomonjayceon1284 2 года назад
@Maximo Mohamed I really appreciate your reply. I got to the site through google and im in the hacking process now. Looks like it's gonna take quite some time so I will get back to you later with my results.
@solomonjayceon1284
@solomonjayceon1284 2 года назад
@Maximo Mohamed It did the trick and I now got access to my account again. I'm so happy:D Thanks so much, you really help me out !
@Canda-fh4xc
@Canda-fh4xc 5 лет назад
This is my second tutorial series with you. I already finished Python Flask Tutorial. I watched multiple Django tutorials. Free (blogs and RU-vid) AND Paid(Udemy, edx,..). Your way of teaching is completely different. You are real instructor. You made Django/python really simple to anyone who wants to learn the language. I will make sure to share your RU-vid Tutorial Channel with everyone I know/meet Thank you so much,
@coreyms
@coreyms 5 лет назад
Thanks!
@user-ji7yl1wq6r
@user-ji7yl1wq6r 3 месяца назад
while trying logout im getting, This page isn’t workingIf the problem continues, contact the site owner. HTTP ERROR 405 error. what should i do?!
@Canda-fh4xc
@Canda-fh4xc 3 месяца назад
@@user-ji7yl1wq6r "Method Not Allowed" error. Check the URL Routing
@phantomtrouper2652
@phantomtrouper2652 3 месяца назад
@@user-ji7yl1wq6r {% if user.is_authenticated %} {% csrf_token %} Logout {% else %} Login Register {% endif %}
@thiagokkawakita
@thiagokkawakita 3 месяца назад
This method is obsolete, google "405 logout" @@user-ji7yl1wq6r
@olaniyiajayi8012
@olaniyiajayi8012 5 месяцев назад
If you have error 405 page on logout page it may be due to latest django version this is what I did to get round it. In users views folder i put this code from django.contrib.auth import logout def logout_view(request): logout(request) return render(request, 'users/logout.html') then in main project urls I put this in urr parttern list path("logout/", user_views.logout_view, name="logout"), You can comment out the former url path of logout
@jaedenhero548
@jaedenhero548 4 месяца назад
Works. Thank you very much!
@maxchapin52
@maxchapin52 4 месяца назад
This worked! Thank you!
@danihlzita2345
@danihlzita2345 3 месяца назад
Worked out perfectly! Thanks a lot!!!
@dragonladycrafts
@dragonladycrafts 3 месяца назад
Thank you so much. This helped me out a lot.
@jonathanbriones3235
@jonathanbriones3235 2 месяца назад
hey guys, this is the way. it worked for me!
@sarthakbhutani7413
@sarthakbhutani7413 3 года назад
I really love that : "we haven't created this yet but we will in just a second"! God bless you sir.
@waleedabdulmanea5301
@waleedabdulmanea5301 4 года назад
I like when he says, 'we are gonna fix this in a second', the instructor is reading our minds, good job, and keep the great work, i am one of your students :)
@sharathkrishnan1558
@sharathkrishnan1558 4 года назад
Not only are these tutorials the best.. But the way you explain, it motivates me to carry on further and it really creates interest in the subject
@sebastianb2092
@sebastianb2092 4 года назад
Like I'm watching these videos for 3 days now every day after work and continuingly learning about Python and the Django framework. Love it @Corey Schafer
@olhamarushchak3514
@olhamarushchak3514 5 лет назад
Love you so much!! Thank you for this Django course, I've been waiting for so long!
@toastrecon
@toastrecon 4 года назад
Amazing how much functionality is available right out of the box. Thanks, Corey!
@justinlee3453
@justinlee3453 3 года назад
Thanks corey, I've gone over this for the third time, and now this totally makes sense
@commonsense1019
@commonsense1019 Год назад
his clearity about the concepts is visible through his advance yet easy to understand explaination
@aminuolawale1843
@aminuolawale1843 4 года назад
Your Flask Series helped me land my current Python job! You are a great teacher !
@MagnusAnand
@MagnusAnand 5 лет назад
This tutorial is becoming better in every video
@doniyorabduvokhidov1862
@doniyorabduvokhidov1862 4 года назад
The best Django tutorial I've ever seen .. thank you for all of your effort .. really appreciate
@jayedm3342
@jayedm3342 5 лет назад
i dont know why the channels sharing knowledge have only 100k+ subs while nonsense channels have milliions ... GUYS lets hit that subs red btn and make it to million+
@grouchydrago1396
@grouchydrago1396 3 года назад
Trust me I have
@tigger2581
@tigger2581 4 года назад
hands down best tutorials on youtube. and ive watched many
@suryamanipandey8002
@suryamanipandey8002 2 года назад
this series is so amazing that its hard to put in words. Thank you for teaching so much in so less time.
@roshanpandey5357
@roshanpandey5357 5 лет назад
Well, this video is awesome as others of the same series. Just loved it :-)
@vp9041
@vp9041 5 лет назад
Annoyed in the past about not having that next function, truly a nice feature, well explained nice video
@Klutche
@Klutche 3 года назад
I can't wait to bring my idea to life with your guidance! Thanks Corey for all you've done! I will follow up once i've deployed my first app!
@liviumircea6905
@liviumircea6905 5 лет назад
amazing ...one of the best tutorials on django
@geolegacy2
@geolegacy2 4 года назад
7 videos in and so far still so good! God bless
@slan7
@slan7 4 года назад
God-tier tutorials. Thank you, sir.
@Marek-zt9fy
@Marek-zt9fy 4 года назад
I love your tutorials, you're amazing man, keep it up!
@godeytech
@godeytech Год назад
I really love this. Easy to understand and easy to practice on your own
@PrieyudhaAkaditaS
@PrieyudhaAkaditaS 4 года назад
The best django tutorial ive ever seen. Thankyou
@akshaykaushik9
@akshaykaushik9 4 года назад
love you bro.Watched every video available on your channel. Everything learned from you. Feels like i know python as intermediate although it is hard to keep remember every topic.
@ashrafulfuad2967
@ashrafulfuad2967 4 года назад
Thank you so much I learned total django from your tutorial series . now my project is going on
@lkarthik1985
@lkarthik1985 5 лет назад
Hi Corey, Thanks for this excellent video.
@romnegrillo
@romnegrillo 3 года назад
You can still view the login page even though you're logged in. You can change your login route as: path("login/", auth_views.LoginView.as_view(template_name = "users/login.html", redirect_authenticated_user=True), name="login"), so it will be reditected to blog-home route when you try to access the login page even though you;re authenticated. I'm loving this series. Your tutorial is really good. You explain complex problems into simple terms.
@demaxl732
@demaxl732 Год назад
Thanks
@ASADULLAHGALIB25
@ASADULLAHGALIB25 5 лет назад
Corey Schafer, you are the best teacher 👌
@harwinderthakur9708
@harwinderthakur9708 4 года назад
I was surprised to see how well crispy forms work with django . It's like a magic don't have to do anything.
@shadow_was_here
@shadow_was_here 4 года назад
The Best django tutorial.. Love your teachings man. Great work.
@banaras.wala.foreignaala
@banaras.wala.foreignaala 4 года назад
Hi Corey, So far so good, I want to say thanks for your efforts.
@congcuongnguyen413
@congcuongnguyen413 2 года назад
0:31 built-in login/logout page for user 1:02 import auth_views & create path 2:53 create templates for those views 8:37 setting login_redirect_url 11:28 redirect to login page after register 12:32 create template for logout page 16:37 change navigation bar base on login/logout 18:20 built-in user variable contain current user 20:55 restriction on certain route if not login 21:47 create profile view & template & URL 25:57 login_required decorator 27:50 setting login_url 28:43 ?next=...
@user-ji7yl1wq6r
@user-ji7yl1wq6r 3 месяца назад
while trying logout im getting, This page isn’t workingIf the problem continues, contact the site owner. HTTP ERROR 405 error. can you help me please
@minsuga2988
@minsuga2988 3 месяца назад
Did the error get solved can u tell me how
@mychal.b
@mychal.b 3 месяца назад
@@user-ji7yl1wq6r im having the same error. in the command line it says Method Not Allowed (GET): /logout/ but i dont know how to fix it
@mychal.b
@mychal.b 3 месяца назад
@@user-ji7yl1wq6r {% csrf_token %} logout try this
@thiagokkawakita
@thiagokkawakita 3 месяца назад
This method is obsolete, google "405 logout"@@mychal.b
@moebazzi8412
@moebazzi8412 5 лет назад
AMAZING AND CLEAR TUTORIALS WELL DONE COREY!!!
@vladadidko3932
@vladadidko3932 5 лет назад
Thank you, Corey! You're the best)
@jear3559
@jear3559 5 лет назад
Hi Corey, Thanks for this tutorial... it helps me a lot...
@namesare4fools
@namesare4fools 4 года назад
LOVE IT !! I would like to see a more advance django tutorials.. :)
@osamakhan5381
@osamakhan5381 5 лет назад
Epic Tutorials, Keep up the good work
@ralphcaritativo2033
@ralphcaritativo2033 5 лет назад
DONE TUTORIAL #7! Thank you SENPAI! :)
@abdulahamer6238
@abdulahamer6238 4 года назад
Super cool adding features and helping to put students in a user mindset to see functionality and feedback that users will enjoy and will help make things feel intuitive and easy to use
@GDLAPROD
@GDLAPROD 2 года назад
Wow! Impressive. Everything is still relevant.
@harshbhatt4527
@harshbhatt4527 3 года назад
Sir great work I have not seen a django playlist like this!!!
@ashG1234
@ashG1234 5 лет назад
Dear Corey THANK YOU for producing such wonderful videos. Much appreciated. I would request you to produce 2 more videos - 1) Token Based authentication (must required for REST apps) and 2) Use of the token for fetching information.
@tahhaa906
@tahhaa906 3 года назад
I Really like when he says : " that django provides for us ".
@jamatiasabirdfarming7760
@jamatiasabirdfarming7760 3 года назад
very easy and helpful series, thank you Corey.
@paulohsgoes1959
@paulohsgoes1959 3 года назад
Another great tutorial of yours. Congrats!
@sarunasj
@sarunasj 5 лет назад
This is amazing. Simple and to the point. I'm now going to go back to Part 1. Thank you!
@suneelarumalla
@suneelarumalla 5 лет назад
Nice videos,thanks for all your hard work
@petergames4819
@petergames4819 2 года назад
Love these tutorial videos! Thanks!
@akramnarejo6221
@akramnarejo6221 4 года назад
Corey you're amazing really a great blessing. thanks man.
@vegadevelopers
@vegadevelopers 3 месяца назад
Thank you so much with details explanations and teaching. 👌👌👌 Quality Tutorial!
@walter1323
@walter1323 5 лет назад
Thank you for such a great video!!
@Raphael-bq1fc
@Raphael-bq1fc 2 года назад
Thank you very much! exactly what I was searching for; even more..
@shreyas0002
@shreyas0002 5 лет назад
Basically Corey Is A Magician, Guy Knows What problem will arise due to every Small Changes in code and even fixes it!
@andrewchen7710
@andrewchen7710 5 лет назад
Thank you so much Corey! Really helps my startup on building on page! Whether we succeed or not we owe a huge one to you!
@coreyms
@coreyms 5 лет назад
Good luck! What kind of startup?
@NphiniT
@NphiniT 5 лет назад
@@coreyms I am gonna use this for my startapp too. It is basically an online bus ticket booking system for travelling within Ghana. I plan on creating Android and iOS Apps for it as well. Any advice and Pointers??
@ALEXEIS
@ALEXEIS 5 лет назад
@@NphiniT You need a partner?
@NphiniT
@NphiniT 5 лет назад
@@ALEXEIS How good is your front-end development? E-mail me: nurudeen.karim2016@gmail.com
@godfreynolottyogwu8562
@godfreynolottyogwu8562 5 лет назад
@@NphiniT great idea
@tashiwangchuk9126
@tashiwangchuk9126 5 лет назад
Thank you so much for the tutorial.
@boomnj127
@boomnj127 5 лет назад
thank you for every thing. you are the best teacher
@fariborzseyedi9711
@fariborzseyedi9711 4 года назад
Very Very nice videos. thank you Corey. I will suggest this tutorial to every one that want learn Django.
@SandeepPareek1
@SandeepPareek1 3 года назад
oh you are the best guy !.... really good tutorials.. keep the good work up .. 1000 thumbs up for you .
@wentaoqiu4072
@wentaoqiu4072 4 года назад
You’re a teaching god.
@sanjaydangwal2501
@sanjaydangwal2501 4 года назад
these tutorials are very helpful.
@juniormichaelseri5212
@juniormichaelseri5212 5 лет назад
Fantastic tutorial!
@jamesskipworth5142
@jamesskipworth5142 3 года назад
Suggestion for anyone recreating to add 'redirect_authenticated_user=True' at 4:50 so already logged in users are redirected through the login page. Loved the series though Corey really helped with my school project.
@islamh6042
@islamh6042 3 года назад
Thanks a lot for a great series!
@LamusWhiteALM
@LamusWhiteALM 5 лет назад
Thanks Corey :)
@cgunawan
@cgunawan 5 лет назад
This awesome! This helps alot
@hasan8267
@hasan8267 5 лет назад
Great tutorials! Thanks
@easazade
@easazade 5 лет назад
thank you for this tutorial specially for doing a django 2.x tutorial
@albertoleaplaza3048
@albertoleaplaza3048 4 года назад
The Best Videos I have seen so far!!!!
@wozdog7425
@wozdog7425 3 года назад
something about you Corey ... I always come away feeling smarter !!
@TRGIZATION
@TRGIZATION 3 года назад
Your videos are really helpful. Thank you
@thiagonunes2751
@thiagonunes2751 2 года назад
Brilliant videos, congratulations!!!!
@superrelaxation508
@superrelaxation508 Год назад
Going amazing so far best instructor suggest according to chatgpt and it is true thanks sir
@lightninginmyhands4878
@lightninginmyhands4878 5 лет назад
27:50 `LOGIN_URL` is used to override Django's default URL when a user is trying to access a `login_required` site. We have created our own login route thus `LOGIN_URL` will be assigned to that.
@shikunchen8523
@shikunchen8523 4 года назад
how can we fix it when login the page always redirects to the home page instead of profile page?
@imawo
@imawo 3 месяца назад
i'm encountring the same problem . did yo get where's the problem?@@shikunchen8523
@paridhigupta2747
@paridhigupta2747 2 года назад
Best teacher ever.
@teddytalks499
@teddytalks499 4 года назад
Thanks Corey
@gabrieludoudo2718
@gabrieludoudo2718 5 лет назад
Thanks Sir for giving us the best Django videos on RU-vid , Please can you do a video on how to upload audio file in django
@pratikchakravorty6623
@pratikchakravorty6623 4 года назад
Great video. Just one small thing to not let the user go back and access the register and login page after they have logged in add the redirected_authenticated_user=TRUE to the login path in the project's urlconf and also add a check to the register view. You can access the user using request.user
@sahilbisht3661
@sahilbisht3661 4 года назад
simply awesome thank you so much sir these videos helped me a lot love from India !!
@saliksheraz6236
@saliksheraz6236 4 года назад
Great and helpful tutorials
@lightninginmyhands4878
@lightninginmyhands4878 5 лет назад
Excellent. Simple.
@ahmad-ali14
@ahmad-ali14 5 лет назад
this is the best toturial
@AbhishekKumar-mq1tt
@AbhishekKumar-mq1tt 5 лет назад
Thank u for this awesome video and series
@md.soleymankhan6550
@md.soleymankhan6550 4 года назад
Best Django tutorial.
@mhmt_dmr
@mhmt_dmr 3 года назад
Thanks Corey for the perfect lessons. 40 dislike comes from udemy sellers :)
@hamza-325
@hamza-325 3 года назад
Thanks for the tutorial! I noticed how much login.html and register.html are similar, so I have merged them into a single page that changes its title and the small text according to the {{request.path}}.
@arindammukherjee391
@arindammukherjee391 5 лет назад
Thanks Corey for such an awesome series. I was hoping to learn the Django Rest Framework as well so will you do it in future for another project?
@namanjain8002
@namanjain8002 5 лет назад
Love you Corey... : )
@user-wl6tj6hm3g
@user-wl6tj6hm3g 2 месяца назад
I love it how you taught any topic in such a easy way In my project on opening logout page it was showing 405 error and page breakdown. I have tried various thing but it was not helping so help me in this.
@sajadtorkamani9399
@sajadtorkamani9399 4 года назад
Another great video!
@angeldiaries2331
@angeldiaries2331 7 месяцев назад
Truely very informative video
@shashanksharmadon4295
@shashanksharmadon4295 4 года назад
Awesome bro thanks best video ever.....
@TUSHAR-mj1en
@TUSHAR-mj1en 2 года назад
Love from India Thank u BHAI
@derekkroeker4582
@derekkroeker4582 3 года назад
3:37 Got that one many times... Didn't get exactly "TemplateDoesNotExist" on the other videos, but this time yes.
@abdifatahwebdeveloper117
@abdifatahwebdeveloper117 3 года назад
I learned a lot thanks
@najeebmoneeb
@najeebmoneeb 3 года назад
A very help full tutorial sir
@stephenhunt7760
@stephenhunt7760 4 года назад
Very good video enjoyed it, thank you
Далее
Он тоже из IKEA 🙀
00:10
Просмотров 383 тыс.
PLEASE Use These 5 Python Decorators
20:12
Просмотров 98 тыс.
Login and Logout - Django Wednesdays ECommerce 7
20:33
Python Django Tutorial for Beginners
1:02:36
Просмотров 2,4 млн
Он тоже из IKEA 🙀
00:10
Просмотров 383 тыс.