Opened 14 years ago

Closed 14 years ago

#15598 closed (fixed)

When STATIC_URL starts with 'http://' an exception is thrown in DEBUG mode

Reported by: Sergey Grigoriev Owned by: Jannis Leidel
Component: contrib.staticfiles Version: 1.3-rc
Severity: Keywords: blocker
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have set up Apache to serve my static files,
STATIC_ROOT is /var/www/static

STATIC_URL is 'http://localhost/static'

The error is:

ImproperlyConfigured at /booking/page1

URL 'http://localhost/static' not allowed as static prefix

Request Method: GET
Request URL: http://localhost:8000/booking/page1
Django Version: 1.3 rc 1
Exception Type: ImproperlyConfigured
Exception Value:

URL 'http://localhost/static' not allowed as static prefix

Exception Location: /usr/local/lib/python2.6/dist-packages/django/conf/urls/static.py in static, line 23
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:

['/home/serg/Work/sms/webui',

'/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload',
'/usr/local/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/usr/lib/pymodules/python2.6',
'/usr/lib/python2.6/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.6/gtk-2.0']

Attachments (1)

patch.txt (594 bytes ) - added by Sergey Grigoriev 14 years ago.
Patch

Download all attachments as: .zip

Change History (6)

comment:1 by Sergey Grigoriev, 14 years ago

After setting DEBUG to False in settings.py the exception is not thrown anymore.

elif ':' in prefix:

raise ImproperlyConfigured("URL '%s' not allowed as static prefix" % prefix)

I don't think that the developer in DEBUG mode should be limited to use relative path only.

comment:2 by Sergey Grigoriev, 14 years ago

Summary: When STATIC_URL starts with 'http://' an exception is thrownWhen STATIC_URL starts with 'http://' an exception is thrown in DEBUG mode

by Sergey Grigoriev, 14 years ago

Attachment: patch.txt added

Patch

comment:3 by Sergey Grigoriev, 14 years ago

Has patch: set

comment:4 by Russell Keith-Magee, 14 years ago

Keywords: blocker added

Not sure what the right response is here, but it's a problem with a new feature, so marking as a blocker to make sure it isn't forgotten before 1.3 final.

comment:5 by Jannis Leidel, 14 years ago

Owner: set to Jannis Leidel
Resolution: fixed
Status: newclosed

In [15839]:

Fixed #15598 -- Updated static URL helper to be no-op on non-local prefixes. Thanks, traff.

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