[Django] #31126: Document static file namespaces (prefixes) in Managing Static Files documentation

9 views
Skip to first unread message

Django

unread,
Dec 29, 2019, 4:53:16 AM12/29/19
to django-...@googlegroups.com
#31126: Document static file namespaces (prefixes) in Managing Static Files
documentation
-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master
Documentation | Keywords: documentation,
Severity: Normal | static-files
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently, the '''Managing Static Files''' documentation page doesn't
mention anything about namespaces (prefixes). It is logical to expect
information regarding this on the page that deals with static files.
However, the details are mentioned in Django '''Settings''' page under the
setting.

I propose that the documentation be moved from '''Settings''' page to
'''Managing Static Files''' page and add a link from the former to the
latter. A quicker alternative would be the other way round.

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

Django

unread,
Dec 30, 2019, 2:58:52 AM12/30/19
to django-...@googlegroups.com
#31126: Add a cross-reference to the staticfiles prefixes in the "Configuring
static files" docs.

-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: documentation, | Triage Stage: Accepted
static-files |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Unreviewed => Accepted


Comment:

IMO both docs are in the right places, moreover `howto/static-
files/index.txt` mentions namespaces in the `Static file namespacing`
admonition. Nevertheless adding a cross reference to the
`docs/ref/settings.txt` seems like a good idea, e.g.
{{{
--- a/docs/howto/static-files/index.txt
+++ b/docs/howto/static-files/index.txt
distinguish between them. We need to be able to point Django at the
right
- one, and the best way to ensure this is by *namespacing* them. That
is,
- by putting those static files inside *another* directory named for
the
- application itself.
+ one, and the best way to ensure this is by :ref:`namespacing them
+ <staticfiles-dirs-prefixes>`. That is, by putting those static files
inside
+ *another* directory named for the application itself.

--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt

+.. _staticfiles-dirs-prefixes:
+
Prefixes (optional)
~~~~~~~~~~~~~~~~~~~
}}}

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

Django

unread,
Dec 30, 2019, 4:14:25 AM12/30/19
to django-...@googlegroups.com
#31126: Add a cross-reference to the staticfiles prefixes in the "Configuring
static files" docs.
-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: documentation, | Triage Stage: Accepted
static-files |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

> Currently, the '''Managing Static Files''' documentation page doesn't
> mention anything about namespaces (prefixes). It is logical to expect
> information regarding this on the page that deals with static files.
> However, the details are mentioned in Django '''Settings''' page under
> the setting.
>
> I propose that the documentation be moved from '''Settings''' page to
> '''Managing Static Files''' page and add a link from the former to the
> latter. A quicker alternative would be the other way round.

New description:

--

Comment (by Abhijeet):

Replying to [comment:1 felixxm]:


> IMO both docs are in the right places, moreover `howto/static-
files/index.txt` mentions namespaces in the `Static file namespacing`
admonition. Nevertheless adding a cross reference to the
`docs/ref/settings.txt` seems like a good idea, e.g.
> {{{
> --- a/docs/howto/static-files/index.txt
> +++ b/docs/howto/static-files/index.txt
> distinguish between them. We need to be able to point Django at the
right
> - one, and the best way to ensure this is by *namespacing* them. That
is,
> - by putting those static files inside *another* directory named for
the
> - application itself.
> + one, and the best way to ensure this is by :ref:`namespacing them
> + <staticfiles-dirs-prefixes>`. That is, by putting those static
files inside
> + *another* directory named for the application itself.
>
> --- a/docs/ref/settings.txt
> +++ b/docs/ref/settings.txt
>
> +.. _staticfiles-dirs-prefixes:
> +
> Prefixes (optional)
> ~~~~~~~~~~~~~~~~~~~
> }}}

The `Static file namespacing` admonition in `howto/static-files/index.txt`
mentions namespaces in relation with static files for a particular app
(`my_app/static`). I am talking about prefixes in context of
`FileSystemFinder` and the `STATICFILE_DIRS` setting.

The reason why I speak of prefixes in particular is because I had a
particular case where I needed them to be served as static files and at
the same time include them in a meaningful directory structure of my code
repository. The default action is the contents of the files are moved to
the `STATIC_ROOT` folder. Using prefixes meant I could namespace the
static files properly and hence link to them (from outside templates)
using straight forward and intutive links.


I'll have a patch ready by tonight.

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

Django

unread,
Dec 30, 2019, 4:19:54 AM12/30/19
to django-...@googlegroups.com
#31126: Add a cross-reference to the staticfiles prefixes in the "Configuring
static files" docs.
-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: documentation, | Triage Stage: Accepted
static-files |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

New description:

Currently, the '''Managing Static Files''' documentation page doesn't
mention anything about namespaces (prefixes). It is logical to expect
information regarding this on the page that deals with static files.
However, the details are mentioned in Django '''Settings''' page under the
setting.

I propose that the documentation be moved from '''Settings''' page to
'''Managing Static Files''' page and add a link from the former to the
latter. A quicker alternative would be the other way round.

--

Comment (by Abhijeet):

I removed the description in my previous comment by mistake. Sorry for
that.
Adding it back in here.

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

Django

unread,
Dec 30, 2019, 8:05:56 AM12/30/19
to django-...@googlegroups.com
#31126: Add a cross-reference to the staticfiles prefixes in the "Configuring
static files" docs.
-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: documentation, | Triage Stage: Accepted
static-files |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Abhijeet):

* has_patch: 0 => 1


Comment:

Patch: https://github.com/django/django/pull/12261

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

Django

unread,
Jan 29, 2020, 4:34:57 AM1/29/20
to django-...@googlegroups.com
#31126: Add a cross-reference to the staticfiles prefixes in the "Configuring
static files" docs.
-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

Keywords: documentation, | Triage Stage: Accepted
static-files |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"a45c8d7ad04b73e33b6989c3ffa2b8c51ae3e83b" a45c8d7a]:
{{{
#!CommitTicketReference repository=""
revision="a45c8d7ad04b73e33b6989c3ffa2b8c51ae3e83b"
Fixed #31126 -- Doc'd STATICFILES_DIRS namespacing in static files how-to.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31126#comment:5>

Django

unread,
Jan 29, 2020, 4:37:32 AM1/29/20
to django-...@googlegroups.com
#31126: Add a cross-reference to the staticfiles prefixes in the "Configuring
static files" docs.
-------------------------------------+-------------------------------------
Reporter: Abhijeet | Owner: Abhijeet
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: documentation, | Triage Stage: Accepted
static-files |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"7d48a4b703b24607ea77e8c1074d832dfdbdf832" 7d48a4b7]:
{{{
#!CommitTicketReference repository=""
revision="7d48a4b703b24607ea77e8c1074d832dfdbdf832"
[3.0.x] Fixed #31126 -- Doc'd STATICFILES_DIRS namespacing in static files
how-to.

Backport of a45c8d7ad04b73e33b6989c3ffa2b8c51ae3e83b from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31126#comment:6>

Reply all
Reply to author
Forward
0 new messages