I'm am trying to use the generic login view provided by django and this is my urls.py:
url(r'^login/$', django.contrib.auth.views.login),
When I run the server and go to
127.0.0.1
it gives me a
NameError at /
saying
name 'django' is not defined
when I remove 'django' and just leave it at
contrib.auth.views.login
it gives a
NameError at /
saying
name 'contrib' is not defined
any idea why and how to fix this?
Instead of django.contrib.auth.views.login, try at the top of your urls.py stating: from django.contrib.auth import views. Then, in your url login pattern, where you originally put django.contrib.auth.views.login, replace it with views.login. If this doesn't work, please post your full urls.py.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With