Django 1.9 Won't Render The Right Page In Links
Solution 1:
You need to include a dollar sign at the end of your regex.
url(r'^$', views.login, name="login"),
Without the dollar sign, the regex r'^'
will match all urls, so any url patterns below this one will be ignored.
You can actually remove this url and resetpwd
from the root url config, because you already include these views in the included mechanics.urls
.
Note that Django comes with an authentication system. You should use this rather than trying to write your own.
Solution 2:
There are several issues with your code:
First and foremost, you are completely working around Django's authentication system. If you know what you are doing this is fine (though it really makes you wonder why you are using Django, then).
In any other case, you should really be using it because:
- you are using plain text passwords (Django would not)
- you are not authenticating the user in Django thus you will not be able to use any of the features that come along with Django based on authentication, like the decorator
login_required()
which will handle correct redirecting to the login page, localization, permissions, password resetting via e-mail and many more.
As a side note:
You have two login
and resetpw
pages, and you include the admin site twice (in the base urls.py and in the mechanics one).
Post a Comment for "Django 1.9 Won't Render The Right Page In Links"