collectstatic command excluding nested directories and files

Viewed 462

I'm trying to exclude some of the files and directories from static folder for collectstatic command.

static
  -sample
  -css
     -dest
     -vendor 
     index.css 

I want to exclude the vendor directory and file index.css.

Tried following:

python manage.py collectstatic -i css/vendor -i css/*.css -i sample

It excluded the sample but not vendor directory and file index.css.

What could be the possible solution for this ?

1 Answers

Unfortunately you can't do that. because currently django collectstatic management command, doesn't support ignoring path. you can just use name of folders and pass it as as --ignore input.

So in your case collectstatic can ignore the folder with name sample, but others are path and can't be ignored. (I know it's not a good answer to hear, but that's what it is currently on django)

Related