Django

Code

Ticket #6537 (new)

Opened 3 months ago

Last modified 2 months ago

Unhelpful error message: 'tuple index out of range'

Reported by: Michael@Hipp.com Assigned to: nobody
Component: Core framework Version: SVN
Keywords: url error message tuple index Cc: hv@tbz-pariv.de
Triage Stage: Accepted Has patch: 1
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

There's something evidently wrong with my urls.py, but this error message is absolutely no help in sorting it out. Please have it output which tuple it's trying to index. The error message is providing no context, and unlike normal python tracebacks it is not tied to a particular line in my urls.py.

Traceback (most recent call last):

  File "c:\django\django\core\servers\basehttp.py", line 277, in run
    self.result = application(self.environ, self.start_response)

  File "c:\django\django\core\servers\basehttp.py", line 631, in __call__
    return self.application(environ, start_response)

  File "c:\django\django\core\handlers\wsgi.py", line 205, in __call__
    response = self.get_response(request)

  File "c:\django\django\core\handlers\base.py", line 130, in get_response
    callback, param_dict = resolver.resolve500()

  File "c:\django\django\core\urlresolvers.py", line 275, in resolve500
    return self._resolve_special('500')

  File "c:\django\django\core\urlresolvers.py", line 264, in _resolve_special
    callback = getattr(self.urlconf_module, 'handler%s' % view_type)

  File "c:\django\django\core\urlresolvers.py", line 255, in _get_urlconf_module
    raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e)

ImproperlyConfigured: Error while importing URLconf 'reports.urls': tuple index out of range

Here's the urls.py that is evidently not acceptable, but I cannot see which tuple of tuples of tuples it is trying to index and failing on:

from django.conf.urls.defaults import *
import views as views
import settings

urlpatterns = patterns('',
    # Example:
    # (r'^reports/', include('reports.foo.urls')),
    (r'^$', views.home_page),
)

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^images/(?P<path>.*)$', 'django.views.static.serve',
         {'document_root': 'c:/projects/djcode/reports/images'}),
        (r'^css/(?P<path>.*)$', 'django.views.static.serve',
         {'document_root': 'c:/projects/djcode/reports/css'}),
    )

Attachments

6537.diff (2.8 kB) - added by guettli on 03/28/08 10:26:46.

Change History

02/02/08 12:07:40 changed by anonymous

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

03/28/08 10:25:47 changed by guettli

  • cc set to hv@tbz-pariv.de.
  • has_patch set to 1.
  • stage changed from Unreviewed to Accepted.

I can't reproduce your exception, but I know the problem. Up to now the original exception is lost. I wrote a patch which passes the exception up to the debug view.

Please test and leave a comment.

03/28/08 10:26:46 changed by guettli

  • attachment 6537.diff added.

Add/Change #6537 (Unhelpful error message: 'tuple index out of range')




Change Properties
Action