#16832 closed Cleanup/optimization (wontfix)
add staticfiles lines to urls.py ,
Reported by: | 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)
Change History (7)
by , 13 years ago
Attachment: | added_staticfiles_to_default_urls.diff added |
---|
comment:1 by , 13 years ago
Easy pickings: | set |
---|---|
Has patch: | set |
comment:2 by , 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 docs says:
This view is automatically enabled by runserver (with a DEBUG setting set to True).
What's the use case for adding these lines to the default urls.py?
comment:3 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
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 , 13 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
comment:5 by , 13 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Err, this is a wontfix :)
comment:6 by , 13 years ago
Totally agree!
I'm sorry, I misread the docs.
Great default by the way, thanks Jannis.
patch for ticket 16382: adding (commented) staticfiles lines to urls.py