I have the following urls:
urlspatterns=[ path('<str:urlsername>/', views.profile, name='profile'),
path('login/', auth_views.LoginView.as_view(),name ='login'),
path('logout/', auth_views.LogoutView.as_view()),
path('password_change/', auth_views.PasswordChangeView.as_view(),name='password_change'),]
In views for the first url I have this:
def profile(request, username):
user = get_object_or_404(User, username = username)
posts = Post.objects.filter(author = user).order_by('-pub_date')
return render(request,'profile.html', {'posts':posts,'user':user})
So when I go to the page login, logout or password_change I get the error "Page is not found"
Request Method: GET
Request URL: http://127.0.0.1:8000/password_change/
Raised by: posts.views.profile
But if I comment the profile view and its url everything works just fine. Why does the url 'logout' etc goes to profile view?
question from:
https://stackoverflow.com/questions/65870606/page-is-not-found 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…