Ticket #15199: 15199-collectstatic.patch

File 15199-collectstatic.patch, 973 bytes (added by Bruno Renié, 14 years ago)

Patch for collectstatic, probably needs some improvements

  • django/contrib/staticfiles/management/commands/collectstatic.py

     
    115115        symlink = options['link']
    116116        dry_run = options['dry_run']
    117117
     118        if settings.STATIC_ROOT in settings.MEDIA_ROOT:
     119            media_root = settings.MEDIA_ROOT.replace(settings.STATIC_ROOT, '')
     120            if media_root.startswith('/'):
     121                media_root = media_root[1:]
     122
     123        if destination.split('/')[0] == media_root:
     124            msg = "Skipping '%s' (attempting to write to MEDIA_ROOT)"
     125            self.log(msg % destination)
     126            return False
     127
    118128        if destination in self.copied_files:
    119129            self.log("Skipping '%s' (already copied earlier)" % destination)
    120130            return False
Back to Top