Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#19701 closed Uncategorized (worksforme)

error500 default view don't include STATIC_URL

Reported by: hugo.arregui@… Owned by: nobody
Component: Generic views Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

i was playing with this behaviour when I found this:

https://github.com/django/django/blob/master/django/views/defaults.py#L41

error500 is the only default view which doesn't use RequestContext, then, STATIC_URL is not included.

Is there a reason for that?

Thanks.

Change History (3)

comment:1 by anonymous, 12 years ago

A friend point me to: https://code.djangoproject.com/ticket/5617

But this is a problem.. maybe the default view could insert STATIC_URL from settings without RequestContext?

comment:2 by Mark Lavin, 12 years ago

Resolution: worksforme
Status: newclosed

The reason why it does not use a RequestContext is already documented https://docs.djangoproject.com/en/1.4/topics/http/views/#the-500-server-error-view

The default 500 view passes no variables to this template and is rendered with an empty Context to lessen the chance of additional errors.

You can still use the get_static_prefix https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#get-static-prefix or static https://docs.djangoproject.com/en/1.4/howto/static-files/#with-a-template-tag to reference static files without a RequestContext.

comment:3 by Mike Lissner, 11 years ago

Is it just me, or should we try to document this better? Maybe add it as part of the static configuration page? It's a big gotcha for somebody that's made their 500 page, and has it depend on their base template, where the {{ STATIC_URL }} will work the rest of the time.

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