Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16832 closed Cleanup/optimization (wontfix)

add staticfiles lines to urls.py ,

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

Description

During development, static files can be served using:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()

My proposal is to add these lines, commented, to urls.py so people can enable them quickly.

Attachments (1)

added_staticfiles_to_default_urls.diff (870 bytes ) - added by wim@… 13 years ago.
patch for ticket 16382: adding (commented) staticfiles lines to urls.py

Download all attachments as: .zip

Change History (7)

by wim@…, 13 years ago

patch for ticket 16382: adding (commented) staticfiles lines to urls.py

comment:1 by wim@…, 13 years ago

Easy pickings: set
Has patch: set

comment:2 by Aymeric Augustin, 13 years ago

To the best of my knowledge, it isn't necessary to add anything to the URLconf to serve static files during development. The doc says:

This view is automatically enabled by runserver (with a DEBUG setting set to True).

(https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#django.contrib.staticfiles.templatetags.staticfiles.django.contrib.staticfiles.views.serve)

What's the use case for adding these lines to the default urls.py?

Last edited 13 years ago by Aymeric Augustin (previous) (diff)

comment:3 by Jannis Leidel, 13 years ago

Resolution: duplicate
Status: newclosed

No no, adding staticfiles_urlpatterns is not necessary when using the development server (via runserver), but only if you use an alternative server, like the 3rd party app gunicorn. I'm not convinced that use case is justifies the addition to the default URL.

comment:4 by Jannis Leidel, 13 years ago

Resolution: duplicate
Status: closedreopened

comment:5 by Jannis Leidel, 13 years ago

Resolution: wontfix
Status: reopenedclosed

Err, this is a wontfix :)

comment:6 by Wim Feijen <wim@…>, 13 years ago

Totally agree!

I'm sorry, I misread the docs.

Great default by the way, thanks Jannis.

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