I switched a working project from
{{{#!py
urlpatterns = patterns('',
url(r'^$', 'myapp.views.index', name="home"),
)
}}}
to
{{{#!py
urlpatterns = [ url(r'^$', myapp.views.index, name="home"), ]
}}}
But now I get the exception:
{{{
Exception Type: AttributeError
Exception Value:
'list' object has no attribute 'regex'
Exception Location: D:\Programme\python27\lib\site-
packages\django\core\urlresolvers.py in _populate, line 298
}}}
Because I have the following code snippet in my html template:
{{{
{% url 'home' %}
}}}
----
'''Another item:''' In my settings.py I have
{{{#!py
LOGIN_URL = "/myapp/auth/login/"
}}}
which breaks too.
This one works (at least) if I change it to:
{{{#!py
LOGIN_URL = "myapp.views.login"
}}}
System: I use python 2.7.9 (32 bit) on Windows 7 64 bit.
--
Ticket URL: <https://code.djangoproject.com/ticket/24594>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => worksforme
* needs_tests: => 0
* needs_docs: => 0
Comment:
We will need more specific details about how to reproduce the error (such
as a minimal project we can download). Please include only one "issue" per
ticket as well.
--
Ticket URL: <https://code.djangoproject.com/ticket/24594#comment:1>
Comment (by stephanm):
Hi,
It was my mistake, the old code i my project/urls.py
contained:
{{{#!py
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
}}}
and switching to the list form I changed the code to the '''wrong''' form:
{{{#!py
if settings.DEBUG:
urlpatterns.append( staticfiles_urlpatterns() ) #THIS IS WRONG
}}}
I didn't realize that the old code was still OK because
{{{staticfiles_urlpatterns()}}}
returns a {{{list}}}.
--
Ticket URL: <https://code.djangoproject.com/ticket/24594#comment:2>
* resolution: worksforme => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/24594#comment:3>