Code

Opened 3 years ago

Closed 3 years ago

#15598 closed (fixed)

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

Reported by: sgr Owned by: jezdez
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: UI/UX:

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 sgr 3 years ago.
Patch

Download all attachments as: .zip

Change History (6)

comment:1 Changed 3 years ago by sgr

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 3 years ago by sgr

  • Summary changed from When STATIC_URL starts with 'http://' an exception is thrown to When STATIC_URL starts with 'http://' an exception is thrown in DEBUG mode

Changed 3 years ago by sgr

Patch

comment:3 Changed 3 years ago by sgr

  • Has patch set

comment:4 Changed 3 years ago by russellm

  • 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 Changed 3 years ago by jezdez

  • Owner set to jezdez
  • Resolution set to fixed
  • Status changed from new to closed

In [15839]:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.