Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#15190 closed (fixed)

collectstatic should not symlink files that are already symlinked

Reported by: bendavis78 Owned by: jezdez
Component: contrib.staticfiles Version: 1.3-beta
Severity: Keywords: staticfiles
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


For whatever reason, collectstatic re-symlinks files that are already symlink. If the symlink already exists, it should skip and move on to the next. This can become tiresome during deployments that have hundreds of static files.

Attachments (1)

15190.1.diff (10.8 KB) - added by jezdez 6 years ago.
refactored collectstatic command

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by jezdez

  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Yeah, that seems like a good idea, although we probably want to make sure that the existing symlink points to the wanted source file (e.g. with os.path.exists and/or os.path.realpath).

comment:2 Changed 6 years ago by jezdez

  • Component changed from Contrib apps to django.contrib.staticfiles

comment:3 Changed 6 years ago by jezdez

  • Owner changed from nobody to jezdez
  • Status changed from new to assigned

Changed 6 years ago by jezdez

refactored collectstatic command

comment:4 Changed 6 years ago by jezdez

  • Has patch set

The attached patch solves a few problems of collectstatic:

  • Reliance on set() and therefor not guaranteed order
  • Deleting symlinks even if they refer to the same files
  • Code smell, such as missing comments
  • Shows which directory it copies/links now

comment:5 Changed 6 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [15388]:

Fixed #15190 -- Refactored the collectstatic command to improve the symlink mode and generally straighten out its behavior.

comment:6 Changed 5 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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