Działa to dla mnie ... z LOGIN_URL = '/ kont/login'
Jeśli problem jest że settings.py ma ...
LOGIN_URL = '/login/' # <-- remember trailing slash!
.. ., ale urls.py chce ...
url(r'^login/$',
auth_views.login, {'template_name': '/foo.html'},
name='auth_login'),
Wtedy to zrobić:
# - up top in the urls.py
from django.conf import settings
# - down below, in the list of URLs ...
# - blindly remove the leading '/' & trust that you have a trailing '/'
url(r'^%s$' % settings.LOGIN_URL[1:],
auth_views.login, {'template_name': '/foo.html'},
name='auth_login'),
Jeśli nie można zaufać komukolwiek edytuje swój settings.py ... następnie sprawdzić LOGIN_URL startswith ukośnik & ciach go, czy nie. ... a potem sprawdzić końcowy ukośnik LOGIN_URL endswith ukośnik & halsie go, czy nie ... a, a następnie przykleić na „$”
Ale jak mogę zmieścić że w 'urlpatterns'? :/ –
z django.conf.urls.defaults import * z projectname.settings importować LOGIN_URL urlpatterns = patterns ('', (r '^ articles/2003 /' + LOGIN_URL + '/ $', „wiadomości. views.special_case_2003 '), – AlbertoPL