I keep getting this error: \'str\' object has no attribute \'resolve\'
when trying to accessing the django admin site and I can\'t figure out why. I have apps within
According to excellent answer posted here: http://redsymbol.net/articles/django-attributeerror-str-object-no-attribute-resolve/
There are generally several sources of this error:
You missed 'pattern keyword':
urlpatterns = ('',
(r'^$', direct_to_template, {'template' : 'a.html'}),
# ...
this should be changed to:
urlpatterns = patterns('',
(r'^$', direct_to_template, {'template' : 'a.html'}),
# ...
Note that in Django 1.8+, it's better to use a list of regexes instead of patterns
.
urlpatterns = [
(r'^$', direct_to_template, {'template' : 'a.html'}),
...
]
You missed a comma in some tuple, like:
(r'^hello/$' 'views.whatever')
You commented out some url()s using triple-quotes
You carelessly leave a closing bracket in the wrong place:
(r'^(?P\d{4})/$', 'archive_year', entry_info_dict), 'coltrane_entry_archive_year',
instead of:
(r'^(?P\d{4})/$', 'archive_year', entry_info_dict, 'coltrane_entry_archive_year'),
You set ROOT_URLCONF
to be a list
When migrating from the pattern tuples to a regular list you forgot to remove the empty ''
argument of the pattern.
Please check carefully if you don't have one of this cases in your code.