In my urlpatterns in the url.py file of my app, I have two pages:

from django.urls import path, re_path
from django.conf.urls import url
from . import views
from django.contrib.auth.views import LoginView

urlpatterns=[
re_path(r'^$',views.home, name='home'),
path('login/', LoginView.as_view(template_name='accounts/login.html'), name=
'login'),
]

When I visit : `http://127.0.0.1:8000/home` I see whats in my `index.html`. 

But when I visit : 

`http://127.0.0.1:8000/accounts/login` or 
`http://127.0.0.1:8000/accounts/login.html` or 
`http://127.0.0.1:8000/accounts/login/login` or 
`http://127.0.0.1:8000/accounts/login/login/login.html` 

I still see what's in my `index.html`. Wtf?


Ok. I did say in my views.py I have told it to render `home/index.html` 
like this :

def home(request):
return render(request, 'home/index.html')

But I also have this function in views.py as well :


def login(request):
c = {}
c.update(csrf(request))
return render(request, 'accounts/login.html', c)

So what's the problem? Why won't it render `accounts/login.html` page when 
I visit `http://127.0.0.1:8000/accounts/login`

By the way, In my main url.py file in the project, I have url patterns this 
way *(every django project has two urls.py)*:
urlpatterns = [
path('admin/', admin.site.urls),
path('home/', include('clientview.urls')),
path('accounts/login/', include('clientview.urls')),
]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b14297d2-a879-4642-9c75-82b103297f00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to