[Django] #22109: clarify difference between relative and absolute STATIC_URL

6 views
Skip to first unread message

Django

unread,
Feb 20, 2014, 5:09:33 PM2/20/14
to django-...@googlegroups.com
#22109: clarify difference between relative and absolute STATIC_URL
--------------------------------------+-------------------------------
Reporter: cjerdonek | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords: static_url,static
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+-------------------------------
It seems like there is a qualitative difference in the behavior of
`STATIC_URL` that is worth adding to
[https://docs.djangoproject.com/en/dev/ref/settings/#static-url its
documentation] -- depending on whether the URL is absolute vs relative.
Specifically, the documentation currently only mentions how to //refer//
to static assets (i.e. by prepending `STATIC_URL`). But it doesn't
mention that when `STATIC_URL` is relative, Django will use this setting
to find and serve the file (using also the settings `STATICFILES_DIRS` and
`STATIC_ROOT`, for example).

--
Ticket URL: <https://code.djangoproject.com/ticket/22109>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 20, 2014, 5:09:52 PM2/20/14
to django-...@googlegroups.com
#22109: clarify difference between relative and absolute STATIC_URL
-------------------------------------+-------------------------------------
Reporter: cjerdonek | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.6
Component: Documentation | Resolution:
Severity: Normal | Triage Stage:
Keywords: static_url,static | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by cjerdonek):

* cc: chris.jerdonek@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/22109#comment:1>

Django

unread,
Mar 16, 2014, 1:05:34 PM3/16/14
to django-...@googlegroups.com
#22109: clarify difference between relative and absolute STATIC_URL
-------------------------------------+-------------------------------------
Reporter: cjerdonek | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: 1.6
Component: Documentation | Resolution:
Severity: Normal | Triage Stage:
Keywords: static_url,static | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timo):

I'm not quite sure what you are suggesting. Could you given an example or
offer a patch?

--
Ticket URL: <https://code.djangoproject.com/ticket/22109#comment:2>

Django

unread,
Mar 20, 2014, 4:13:58 AM3/20/14
to django-...@googlegroups.com
#22109: clarify difference between relative and absolute STATIC_URL
-------------------------------------+-------------------------------------
Reporter: cjerdonek | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: 1.6
Component: Documentation | Resolution:
Severity: Normal | Triage Stage:
Keywords: static_url,static | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by cjerdonek):

I can try to find time to come up with a patch. In the meantime, to say a
little more about what I'm getting at, it turns out that the point I was
trying to raise in this issue is discussed in the Django documentation,
though not in the `STATIC_URL` documentation itself (which is supposed to
contain details about the setting). Namely, the point is discussed
[https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/ here] in
the "The staticfiles app" section. For example, it says, "This helper
function will only work if `DEBUG` is `True` and your `STATIC_URL` setting
is neither empty nor a full URL such as http://static.example.com/."

In other words, the functionality I'm referencing only becomes enabled
when `STATIC_URL` is a relative URL reference (i.e. does not contain the
host name, etc).

--
Ticket URL: <https://code.djangoproject.com/ticket/22109#comment:3>

Django

unread,
Mar 20, 2014, 4:36:54 PM3/20/14
to django-...@googlegroups.com
#22109: clarify difference between relative and absolute STATIC_URL
-------------------------------------+-------------------------------------
Reporter: cjerdonek | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.6
Component: Documentation | Resolution: wontfix

Severity: Normal | Triage Stage:
Keywords: static_url,static | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* status: new => closed
* resolution: => wontfix


Comment:

The docs for `STATIC_URL` link to the docs for the `staticfiles` app,
which seems reasonable and DRY to me.

There's tons of useful information in the `staticfiles` docs, including
but not limited to this one, and it isn't a good idea to duplicate it.

--
Ticket URL: <https://code.djangoproject.com/ticket/22109#comment:4>

Reply all
Reply to author
Forward
0 new messages