default login template not found (registration/login.html)

4,238 views
Skip to first unread message

顏大剛

unread,
Nov 20, 2014, 6:39:09 AM11/20/14
to django...@googlegroups.com
Hi,

I follow the doc to test the login system. I set a view function with @login_required to show successful login message.

In the html, a link like:
<li><a href="{% url 'account:login' %}">Login</a></li>

The URLconf under 'account' namespace contains one url:
    url(r'^login/$', 'django.contrib.auth.views.login', name='login',)


It shows the exceptions, and I show the traceback here:
Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
<my project>/templates/registration/login.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python3.2/dist-packages/django/contrib/admin/templates/registration/login.html (File does not exist)
/usr/local/lib/python3.2/dist-packages/django/contrib/auth/templates/registration/login.html (File does not exist)

I found one login.html in 'django/contrib/admin/templates/admin/login.html'.
Is it a bug or I miss something?

Yen

Sergiy Khohlov

unread,
Nov 20, 2014, 6:43:04 AM11/20/14
to django-users
Check  your settings.py for TEMPLATE_DIRS

Many thanks,

Serge


+380 636150445
skype: skhohlov

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFnq%3D1iCtD9KYK52VdOnrUtqEoyCP5b8jNiwYspc2M73X7bJ0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Roseman

unread,
Nov 20, 2014, 7:18:25 AM11/20/14
to django...@googlegroups.com
There is no default login template. If you want a login form, you need to provide a template. See the docs at https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.views.login:
"It’s your responsibility to provide the html for the login template , called registration/login.html by default."
--
DR. 

顏大剛

unread,
Nov 20, 2014, 12:36:24 PM11/20/14
to django...@googlegroups.com
I got it, thank you.

Yen

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages