Reputation: 16656
I started to follow this tutorial and it teaches how to load the index.html
, but now I need to develop a login.html
page, but it seems not be working properly.
urls.py
urlpatterns = patterns('',
url(r'^$', 'provisioning.views.home', name='home'), <- it works!
url(r'^$', 'provisioning.views.login', name='login'), <- doesn't work..
url(r'^admin/', include(admin.site.urls)),
)
views.py
def login(request):
return render(request, 'login.html')
How to setup the pages to be loaded by django ? Is there another and better way in doing this ?
Upvotes: 0
Views: 107
Reputation: 304
You have the same URLs for both home and login. The regex pattern r'^$' specifies that nothing comes after your local host. Because they are the same and Django checks URLs sequentially, only the first url and view is called. Try adding a different url for login.
url(r'^login/$', 'provisioning.views.login', name='login')
Upvotes: 1