Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26973 closed Bug (fixed)

i18n template tag loading error when setting show_indexes=True for views.static.serve

Reported by: MikiSoft Owned by: nobody
Component: Core (Other) Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by MikiSoft)

This is a bug related to the django.views.static.serve and it's reproduced very easily.
First, create a new Django project and add these constants in settings.py:

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

Then, in urls.py add this code:

from django.conf import settings
from django.views.static import serve
if settings.DEBUG:
    urlpatterns += url(r'^'+settings.STATIC_URL[1:]+'(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT, 'show_indexes': True})]

Then create static directory in the project root and put some file(s) in it.
The last step will be to start the development server and to go to that directory (e.g. http://127.0.0.1/static), where response should be the directory listing, but you'll see this odd error:
'i18n' is not a registered tag library.

Change History (6)

comment:1 by MikiSoft, 8 years ago

Component: File uploads/storageTemplate system
Description: modified (diff)

comment:2 by Tim Graham, 8 years ago

Component: Template systemCore (Other)
Triage Stage: UnreviewedAccepted

Bisected to 655f52491505932ef04264de2bce21a03f3a7cd0.

There was some discussion of removing the show_indexes functionality in #11495. The fact that this has been broken for 8 months since the 1.9 release without anyone reporting it might support that idea.

comment:3 by Tim Graham, 8 years ago

Summary: i18n template tag loading error when setting 'show_indexes' to Truei18n template tag loading error when setting show_indexes=True for views.static.serve

comment:4 by Tim Graham, 8 years ago

Has patch: set

Meanwhile, I think removing translation on that page is the path of least resistance: PR.

comment:5 by GitHub <noreply@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 1e32e1c:

Fixed #26973 -- Fixed views.static.serve() crash with show_indexes enabled.

comment:6 by Tim Graham <timograham@…>, 8 years ago

In 02549853:

[1.10.x] Fixed #26973 -- Fixed views.static.serve() crash with show_indexes enabled.

Backport of 1e32e1cc951ac9bada52aa20a9523acc7cc6ecb3 from master

Note: See TracTickets for help on using tickets.
Back to Top