Django Starter with Allauth and Htmx

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

Andreas Jud

Andreas Jud

Күн бұрын

In this tutorial we build a Django Starter project as a foundation for future tutorials, using the Allauth package for User authentication and Htmx to update the User email address.
Assets: github.com/andyjud/django-sta...
Full Code: github.com/andyjud/django-sta...
Live Site: awesomepixx.com
0:00 Demo
3:20 Django Setup
5:40 Homepage
11:05 Profile Pages
21:50 Allauth and Sign Up
30:25 Settings Page with Htmx
40:48 404 Page
Support me on:
Patreon: / andreasjud
Buy me a Coffee: www.buymeacoffee.com/andreasjud
Thank you.
Follow me on:
Twitter: / ajudmeister
Instagram: / ajudmeister
#django #htmx #deployment #allauth #python #pythonprogramming #selftaughtdeveloper #webdevelopment #webapp #stayathomedad

Пікірлер: 59
@rexsybimatrimawahyu3292
@rexsybimatrimawahyu3292 4 күн бұрын
Okay will try this tomorrow because it suck azz to deal with styling for django allauth (i have skill issue reading the doc maybe idk), and here you make things easy af
@maharafhossen7100
@maharafhossen7100 7 күн бұрын
Thanks Andreas,, Amazing Tutorial,, Take love
@FactsStories-w1m
@FactsStories-w1m 17 күн бұрын
He's the GOAT!!
@ajudmeister
@ajudmeister 14 күн бұрын
Thanks :)
@christophermaile3842
@christophermaile3842 5 ай бұрын
As always, I enjoy your great videos. Thanks for the great effort you always put into your work
@DisabledCookie
@DisabledCookie 5 ай бұрын
Thank for this. Keep making htmx and django
@AmoahDevLabs
@AmoahDevLabs 4 ай бұрын
This is really great. Thanks for sharing.
@user-ve4fu1gd7t
@user-ve4fu1gd7t 4 ай бұрын
Thank you for the template, very helpful
@mzwakhe_louw
@mzwakhe_louw 2 ай бұрын
Thank you so much for this. It helped me a lot with my project
@user-bk1eb4xw4o
@user-bk1eb4xw4o 5 ай бұрын
Wonderful new video, thank you for the video.
@deez_dev
@deez_dev 5 ай бұрын
I loved it, keep going
@tatemo_labs
@tatemo_labs 2 ай бұрын
Awesome video! thank you!
@amine63404
@amine63404 5 ай бұрын
I like before I watch, I am sure this will be great.
@ajudmeister
@ajudmeister 5 ай бұрын
Risky …
@sahir3466
@sahir3466 Ай бұрын
awesome tutorial sir. Can you do a video on how to deploy in aws? 🤕[ django, tailwind, postgresql, ci/cd ] . There is no good video available online on the topic .Topic could be "How to deploy django website with CI/CD in aws". Please sir make a video. You have an incredible ability to simplify complex topics. 🧡🧡🧡
@ajudmeister
@ajudmeister Ай бұрын
Hi, yes I might do that. I am planning a docker series aswell, could combine it there. Thanks for suggestion and feedback
@Dorso2009
@Dorso2009 Ай бұрын
Thanks for the video!!!
@ajudmeister
@ajudmeister Ай бұрын
You are welcome :)
@RevMirrane
@RevMirrane 4 ай бұрын
thanks for the vid
@SpeedCodes-oc7ed
@SpeedCodes-oc7ed 5 ай бұрын
your videos are awesome you make any django-backend developer to a frontend developer :)
@ajudmeister
@ajudmeister 5 ай бұрын
haha, you bet!
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
Minor suggestions: 1) Get rid of try except in profile avatar property. I changed it to this: @property def avatar(self): if self.image: return self.image.url return static("images/avatar.svg") 2) Add hyphenation to frontend for profile info. If you type a very long word it is not split into several lines.
@ajudmeister
@ajudmeister 2 ай бұрын
Awesome! Thanks a lot. Updated.
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
@@ajudmeister tried it but even with hyphens-auto long word in info is still not split and goes as far as it can go as if there was no limit to width.
@ajudmeister
@ajudmeister 2 ай бұрын
@@twiceasviewtiful hmm, when i tried the word was split with hyphens-auto. maybe need to add break-words aswell
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
@@ajudmeister it seems that it has to follow some quirky rules to work properly, it works if you type "Kraftfahrzeug­haftpflichtversicherung Kraftfahrzeug­haftpflichtversicherung Kraftfahrzeug­haftpflichtversicherung Kraftfahrzeug­haftpflichtversicherung" but it doesn't if you try "Coooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooool". break-all did help, changed it to {{ profile.info|linebreaksbr }}
@la009895
@la009895 4 ай бұрын
darn you shorts for converting me... and all hail the algorithm for putting this in front of me. I was looking for a simple oauth integration with django!
@ajudmeister
@ajudmeister 4 ай бұрын
All hail the algorithm then! I am glad you find it useful.
@la009895
@la009895 4 ай бұрын
@@ajudmeister so reading the docs, it would be pretty easy to add in google oauth to this, right?
@ajudmeister
@ajudmeister 4 ай бұрын
@@la009895 yes it should be, but haven’t done it yet myself.
@la009895
@la009895 4 ай бұрын
@@ajudmeister I smell a new short. How to add oauth to your project quickly!
@ajudmeister
@ajudmeister 4 ай бұрын
@@la009895 lol, we will see. maybe it takes 2 seconds, no idea yet
@ItsEverythingElse
@ItsEverythingElse Ай бұрын
Great tutorial. Inconsistent use of terms "log out" and "sign out" (easily fixed).
@ajudmeister
@ajudmeister Ай бұрын
Thanks! Yea, it’s always tricky to be consistent 😅
@frameff9073
@frameff9073 5 ай бұрын
Good thank
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
Also noticed that there is a little inconsistency with User model/admin.py. When we login/signup email field is required but it is optional if you create object yourself or through django admin (it's not even present in the Add form).
@ajudmeister
@ajudmeister 2 ай бұрын
Do you mean when the admin creates a new object it should tell him the email is required? How would you go about this?
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
​@@ajudmeister I made custom user model inhereted from AbstractUser. from django.contrib.auth.models import AbstractUser class User(AbstractUser): email = models.EmailField(unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] Added custom model to settings: AUTH_USER_MODEL = "users.User" Added email to add userform in admin: from django.contrib.auth.admin import UserAdmin as BaseUserAdmin @admin.register(User) class UserAdmin(BaseUserAdmin): add_fieldsets = ( ( None, { "classes": ("wide",), "fields": ( "email", "username", "password1", "password2", ), }, ), ) And replaced everywhere from django.contrib.auth.models import User to from django.contrib.auth import get_user_model User = get_user_model()
@IqbalArain-io3du
@IqbalArain-io3du 4 ай бұрын
Thank You. That was great great great ♥. Sir, Do you plan to teach multiple user types example: [teacher, admin, student, parent] ? Best Wishes and Good Luck
@ajudmeister
@ajudmeister 4 ай бұрын
Thank you! I assume you are talking about different permission settings for different groups. I might integrate it in a future project, yes.
@FlectionPoint
@FlectionPoint 4 ай бұрын
Thanks, this is great, but there may be a bug, or I missed a step. If you go to Login, then select "sign up" from the hyperlink after a new user is created they redirect to home rather than profile creation. To fix it update the login.html href --> href="{% url 'account_signup' %}?next={% url 'profile-onboarding' %}"
@ajudmeister
@ajudmeister 4 ай бұрын
Thank you, well spotted! I made a copy of the login.html file from the allauth templates and added the "next" parameter. I also deleted the {% blocktrans %} tag, that was causing an issue there. Cheers!
@codernerd7076
@codernerd7076 5 ай бұрын
Great video! Currently looking into how to use social login with management and connecting accounts, and 2FA with Authenticator apps but can't find anything on KZbin :(
@ajudmeister
@ajudmeister 5 ай бұрын
Thanks. Will put social login and 2FA authentication in the list. allauth has documentation for the different logins, but haven’t tried them out myself yet.
@codernerd7076
@codernerd7076 5 ай бұрын
@ajudmeister thank you! 😊
@fernandtape9363
@fernandtape9363 5 ай бұрын
Very nice, thanks. Can you plz add tailwind configuration with the django-tailwind package?
@ajudmeister
@ajudmeister 4 ай бұрын
i will make another deep dive into tailwind when Tailwind v4 is out.
@SpeedCodes-oc7ed
@SpeedCodes-oc7ed 5 ай бұрын
by the way, i see that you use alpineJS and hyperscript as well, my question is which of them both would you prefer and why?
@ajudmeister
@ajudmeister 5 ай бұрын
i really like alpine because it's easy to use for many often used behaviours. hyperscript is still a bit obscure to me, if I need some custom javascript I might opt to use vanilla javascript instead if I had to choose.
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
Encountered a problem with {% if user.emailaddress_set.first.verified %} in templates/users/profile_settings.html. Had to change first to last ({% if user.emailaddress_set.first.verified %} to show the correct status. Maybe some recent updates to Allauth changed ordering. UPD: Turned out it doesn's matter because there should be only one EmailAddress object. But somehow I had two (initial and changed). Tried to replicate it again but everything's working as intended.
@ajudmeister
@ajudmeister 2 ай бұрын
Are you using allauth? With allauth a user could have more email addresses associated with the same user, thats why I am using .first because it gives me back a list, but should only have one object in it. If you got somehow two, maybe the save method didn't update the email but created a new object instead, then the last might be verified.
@twiceasviewtiful
@twiceasviewtiful 2 ай бұрын
@@ajudmeister Yeah. Turned out I had two because I changed email once before writing post_save signal part that's why a new object was created.
@HummingLaught
@HummingLaught 2 ай бұрын
is this project use ORM? and i wonder if instead of using orm, can we use raw sql🤔
@ajudmeister
@ajudmeister 2 ай бұрын
Yes, it is using Django’s ORM system, however you can write raw SQL queries aswell if you prefer.
@pacifist6271
@pacifist6271 2 ай бұрын
Why can't you explain what are you writing? This is for beginners, so please explain how is this working
@ajudmeister
@ajudmeister 2 ай бұрын
Hello, as I mentioned in the intro this video is a bit advanced and not for absolute beginners. You should check out my backend tutorial series if you are new to django as I explain the concept there in detail. All the best
@anouarben779
@anouarben779 2 ай бұрын
would be very helpful if you could point out how can we load allauth with another language as I believe it supports multi language templates.
@ajudmeister
@ajudmeister 2 ай бұрын
Django indeed supports multi language templates, however I have not worked with them yet, so I can only refer to the official Django documentation.
@anouarben779
@anouarben779 2 ай бұрын
@@ajudmeister thanks Andreas I managed to get them working after a bit of back and forth.
Getting Started With Django All Auth
19:01
Pretty Printed
Рет қаралды 8 М.
Useful gadget for styling hair 🤩💖 #gadgets #hairstyle
00:20
FLIP FLOP Hacks
Рет қаралды 10 МЛН
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 22 МЛН
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН
HTMX Crash Course | Dynamic Pages Without Writing Any JavaScript
56:47
Traversy Media
Рет қаралды 143 М.
Deploy a Django web app to Python Anywhere in 5 Mins [FREE]
9:26
Is HTMX a Joke??
32:15
Syntax
Рет қаралды 19 М.
Docker - Containerize a Django App
24:09
Andreas Jud
Рет қаралды 1 М.
Django Dynamic Forms Tutorial with Htmx
48:27
Matt Freire
Рет қаралды 67 М.
Deploying our Django project to hosting from zero in 25 minutes
24:30
Кибер Весло
Рет қаралды 17 М.
How to add INSTANT database search with Django and HTMX 🕵️
4:40
ToRung short film: 🐶puppy is hungry🥹
0:32
ToRung
Рет қаралды 24 МЛН
Я обещал подарить ему самокат!
1:00
Vlad Samokatchik
Рет қаралды 9 МЛН
Forming of goal foam || A2Z SKLLS
1:00
A2Z SKILLS
Рет қаралды 35 МЛН
МТЗ-80, подписывайтесь на канал, есть видео.
0:56
Александр Маляр
Рет қаралды 5 МЛН