Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14507 closed (fixed)

Static file serving is broken after rev 14293

Reported by: Marco Bonetti Owned by: Jannis Leidel
Component: Core (Other) Version: 1.2
Severity: Keywords: static, static_serve
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Revision [14293] committed to fix issue #12323 introduces a bug that prevents static serving if settings.DEBUG is True.

Attachments (1)

14507.diff (620 bytes ) - added by Marco Bonetti 14 years ago.
Patch to fix

Download all attachments as: .zip

Change History (8)

by Marco Bonetti, 14 years ago

Attachment: 14507.diff added

Patch to fix

comment:1 by Marco Bonetti, 14 years ago

Has patch: set

comment:2 by Jannis Leidel, 14 years ago

milestone: 1.3
Owner: changed from nobody to Jannis Leidel
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:3 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [14306]) Fixed #14507 -- Corrected the logic of the URL helpers and view of staticfiles to actual work like documented (only when settings.DEBUG is True). Thanks for the report and initial patch, mbi.

comment:4 by Jannis Vajen, 14 years ago

Resolution: fixed
Status: closedreopened

I created a Templatetag which renders an AuthenticationForm on every page if the user is not logged in. The form uses context["request"] which is passed to the Templatetag's render() function. When I view the webpage on the development server with settings.DEBUG = False the ImproperlyConfigured exception is not raised as exptected. Instead, all the static files return the following traceback:

Traceback (most recent call last):

  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 281, in run
    self.result = application(self.environ, self.start_response)

  File "/usr/lib/python2.6/dist-packages/django/contrib/staticfiles/handlers.py", line 57, in __call__
    return self.application(environ, start_response)

  File "/usr/lib/python2.6/dist-packages/django/contrib/staticfiles/handlers.py", line 57, in __call__
    return self.application(environ, start_response)

  File "/usr/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 253, in __call__
    response = self.get_response(request)

  File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py", line 155, in get_response
    return self.handle_uncaught_exception(request, resolver, sys.exc_info())

  File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py", line 193, in handle_uncaught_exception
    return callback(request, **param_dict)

  File "/usr/lib/python2.6/dist-packages/django/views/defaults.py", line 24, in server_error
    return http.HttpResponseServerError(t.render(Context({})))

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 173, in render
    return self._render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 809, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/loader_tags.py", line 125, in render
    return compiled_parent._render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 167, in _render
    return self.nodelist.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 809, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 809, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/defaulttags.py", line 258, in render
    return self.nodelist_true.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 809, in render_node
    return node.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/defaulttags.py", line 260, in render
    return self.nodelist_false.render(context)

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 796, in render
    bits.append(self.render_node(node, context))

  File "/usr/lib/python2.6/dist-packages/django/template/__init__.py", line 809, in render_node
    return node.render(context)

  File "/home/jannis/Projekte/[…]/templatetags/loginform.py", line 15, in render
    request = context["request"]

  File "/usr/lib/python2.6/dist-packages/django/template/context.py", line 46, in __getitem__
    raise KeyError(key)

KeyError: 'request'

comment:5 by Honza Král, 14 years ago

Resolution: fixed
Status: reopenedclosed

please don't reopen unrelated tickets.

The error you are seeing has nothing to do with static files and is not a bug - you are missing debug context_processor and the checks for valid configurations aren't run in production mode.

comment:6 by Jannis Vajen, 14 years ago

I'm sorry for reopening the ticket. It seemed apropriate as this behaviour has nothing to do with a missing context_processor but with this specific commit. All previous commits work fine and following commits cause a KeyError rather than an ImproperlyConfigured Exception which is what this Changeset was about, no?

Sorry again.

comment:7 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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