Django getting 530, 5.7.0 Authentication Required despite using google's App Paswords
Have 2fa on Google, created the password, putting in the correct email and app password in the settings.py, yet still get Authentication Error. Tried both 587(TLS=True) and 465(SSL=True) but didn't seem to change anything.
settings.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
EMAIL_HOST_USER = 'mygmail@gmail.com'
EMAIL_PASSWORD = "my16digitpassword"
DEFAULT_FROM_EMAIL = 'mygmail@gmail.com'
What might be the problem/solution? Any answers for this problem feature "use google app password".
from django.shortcuts import render, get_object_or_404, redirect
from .models import Post
from .forms import PostForm
def Home(request, id=None):
if id:
post = get_object_or_404(Post, id=id)
else:
post = None
if request.method == "POST":
if "delete" in request.POST:
post = get_object_or_404(Post, id= request.POST.get("delete"))
post.delete()
return redirect("home")
form = PostForm(request.POST, instance=post)
if form.is_valid():
form.save()
return redirect("home")
else:
form = PostForm(instance=post)
posts = Post.objects.all()
return render(request, "blog/home.html", {"form": form, "posts": posts})