On Mon, Nov 16, 2009 at 8:02 PM, Gene <yum...@gmail.com> wrote: > I'm getting an error that has completely perplexed me: AttributeError: > 'Settings' object has no attribute 'rindex'. > > The complete traceback is listed below. I get this for any request but > a root request '/'. I'm, using Django 1.1 with mod_wsgi. > > The only cases I could find por google of others running into this > error was a few years back in the django 0.95 to 0.96 upgrade- and the > solution- upgrade to 0.96 :/ > > Traceback (most recent call last): > > File "/home/username/webapps/django/lib/python2.5/django/shortcuts/ > __init__.py", line 20, in render_to_response > return HttpResponse(loader.render_to_string(*args, **kwargs), > **httpresponse_kwargs) > > [snip bunches of template render stuff] > File "/home/username/webapps/django/lib/python2.5/django/template/ > __init__.py", line 792, in render_node > return node.render(context) > > File "/home/username/webapps/django/lib/python2.5/django/template/ > defaulttags.py", line 370, in render > url = reverse(self.view_name, args=args, kwargs=kwargs, > current_app=context.current_app) >
This is Django processing a {% url %} tag in the template. {% url %} does reverse mapping and requires that the entire URLconf be valid. > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 350, in reverse > *args, **kwargs))) > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 275, in reverse > possibilities = self.reverse_dict.getlist(lookup_view) > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 195, in _get_reverse_dict > self._populate() > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 175, in _populate > for name in pattern.reverse_dict: > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 195, in _get_reverse_dict > self._populate() > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 187, in _populate > lookups.appendlist(pattern.callback, (bits, p_pattern)) > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 136, in _get_callback > mod_name, func_name = get_mod_func(self._callback_str) > > File "/home/username/webapps/django/lib/python2.5/django/core/ > urlresolvers.py", line 80, in get_mod_func > dot = callback.rindex('.') > > File "/home/username/webapps/django/lib/python2.5/django/utils/ > functional.py", line 273, in __getattr__ > return getattr(self._wrapped, name) > > AttributeError: 'Settings' object has no attribute 'rindex' > Ultimately when trying to initially populate the reverse dictionary for reverse url resolution, the code ran into a situation where instead of an expected callable or string that could be resolved into a callable, a Settings object was found. So, there's something wrong in the overall URLconf. Possibly the local variables you could access from the stack trace on a debug page would point you toward which one. Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.