From 534307699aaf6f1e993ae582617efe059c718c58 Mon Sep 17 00:00:00 2001
From: John Giannelos <johngiannelos@gmail.com>
Date: Tue, 19 Nov 2013 19:04:37 +0200
Subject: [PATCH] Fix collectstatic --link when dangling symlink exists
---
django/contrib/staticfiles/management/commands/collectstatic.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index c1e9fa8..0d1bc24 100644
a
|
b
|
Type 'yes' to continue, or 'no' to cancel: """
|
273 | 273 | os.makedirs(os.path.dirname(full_path)) |
274 | 274 | except OSError: |
275 | 275 | pass |
276 | | os.symlink(source_path, full_path) |
| 276 | try: |
| 277 | if os.path.lexists(full_path): |
| 278 | os.unlink(full_path) |
| 279 | os.symlink(source_path, full_path) |
| 280 | except OSError: |
| 281 | pass |
277 | 282 | if prefixed_path not in self.symlinked_files: |
278 | 283 | self.symlinked_files.append(prefixed_path) |
279 | 284 | |