Loading django/contrib/staticfiles/management/commands/collectstatic.py +2 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,8 @@ class Command(NoArgsCommand): except OSError: pass try: if os.path.lexists(full_path): os.unlink(full_path) os.symlink(source_path, full_path) except AttributeError: import platform Loading tests/staticfiles_tests/tests.py +9 −0 Original line number Diff line number Diff line Loading @@ -694,6 +694,15 @@ class TestCollectionLinks(CollectionTestCase, TestDefaults): """ self.assertTrue(os.path.islink(os.path.join(settings.STATIC_ROOT, 'test.txt'))) def test_broken_symlink(self): """ Test broken symlink gets deleted. """ path = os.path.join(settings.STATIC_ROOT, 'test.txt') os.unlink(path) self.run_collectstatic() self.assertTrue(os.path.islink(path)) class TestServeStatic(StaticFilesTestCase): """ Loading Loading
django/contrib/staticfiles/management/commands/collectstatic.py +2 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,8 @@ class Command(NoArgsCommand): except OSError: pass try: if os.path.lexists(full_path): os.unlink(full_path) os.symlink(source_path, full_path) except AttributeError: import platform Loading
tests/staticfiles_tests/tests.py +9 −0 Original line number Diff line number Diff line Loading @@ -694,6 +694,15 @@ class TestCollectionLinks(CollectionTestCase, TestDefaults): """ self.assertTrue(os.path.islink(os.path.join(settings.STATIC_ROOT, 'test.txt'))) def test_broken_symlink(self): """ Test broken symlink gets deleted. """ path = os.path.join(settings.STATIC_ROOT, 'test.txt') os.unlink(path) self.run_collectstatic() self.assertTrue(os.path.islink(path)) class TestServeStatic(StaticFilesTestCase): """ Loading