#16161: If extra static files are added into STATIC_ROOT, they are transformed
to
symlinks in the next run of ``collectstatic -l``
------------------------------------+-------------------------------------
Reporter: gnotaras | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: contrib.staticfiles
Version: 1.3 | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
------------------------------------+-------------------------------------
Comment (by gnotaras):
Replying to [comment:8 aaugustin]:
> `collectstatic` says that it will overwrite everything inside:
Thanks for your detailed reply. Overwriting or forcing the creation of new
symlinks for the those files that are found by the finders in the app
directories or in the STATICFILES_DIRS, is the expected behavior (at least
for me).
The cleanup of STATIC_ROOT, removing any files or symlinks that are not
found by the finders, could be useful, but it does not take place right
now. There could be a command line switch for collectstatic that adds
cleanup functionality.
> Still, it's true that the current behavior of `collectstatic -l` when
someone adds files to `STATIC_ROOT` does not make sense.
>
> I think the most predictable behavior is to delete any file in
`STATIC_ROOT` that is not found in one of `STATICFILES_DIRS`.
>
> If we don't do this, developers may believe that they can add stuff to
`STATIC_ROOT` ("Hey dude! It just works!"), and that creates a data-loss
problem. Suppose I add manually a "logo.png" file in `STATIC_ROOT` on the
production server, and later on, someone else creates "logo.png" in one of
STATICFILES_DIRS. During the next `collectstatic`, the version from
`STATIC_ROOT` will be overwritten silently and lost!
>
> Short version : if it breaks (ie. a file is overwritten or deleted),
it'd better break now and loudly than at some point in the future and
silently.
You are right about this, but I would prefer deletions inside STATIC_ROOT
to take place only if the user used a command line switch and not by
default.
---
All in all, I'd like to clarify that I did not mean to complain about
''collectstatic''. The way it currently works is fantastic. The only issue
I encountered occurs only if the '''-l''' switch is used, in which case
any files inside STATIC_ROOT that are not found by the static-finders are
replaced by symlinks-to-self. If '''-l''' is not used, then everything
works fine. I am sorry if I did not clarify it from the beginning.
--
Ticket URL: <https://code.djangoproject.com/ticket/16161#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.