Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15190 closed (fixed)

collectstatic should not symlink files that are already symlinked

Reported by: Ben Davis Owned by: Jannis Leidel
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 Jannis Leidel 7 years ago.
refactored collectstatic command

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by Jannis Leidel

milestone: 1.3
Triage Stage: UnreviewedAccepted

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 7 years ago by Jannis Leidel

Component: Contrib appsdjango.contrib.staticfiles

comment:3 Changed 7 years ago by Jannis Leidel

Owner: changed from nobody to Jannis Leidel
Status: newassigned

Changed 7 years ago by Jannis Leidel

Attachment: 15190.1.diff added

refactored collectstatic command

comment:4 Changed 7 years ago by Jannis Leidel

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 7 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [15388]:

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

comment:6 Changed 7 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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