43
Don’t write full path of directories. For example usage:
python manage.py collectstatic --noinput -i admin
This command won’t copy the admin/ directory to STATIC_ROOT path.
12
The Django 2.2 release has finally addressed the very longstanding issue of specifying ignore parameters with path matching, for example
manage.py collectstatic --ignore /vendor/*.js
should then work.
- [Django]-Django: allow line break from textarea input
- [Django]-Django Model set foreign key to a field of another Model
- [Django]-Django REST Framework : "This field is required." with required=False and unique_together
-1
I have a folder structure like this:
my_project
└─content
| └─static
| └─content
| ├─css
| ├─dist
| ├─js
| ├─scss
I want to exclude the scss
folder and all files in it.
I document all the things I tried below.
Here are the commands that DON’T work:
"python manage.py collectstatic --no-input --ignore /content/static/content/scss"
"python manage.py collectstatic --no-input --ignore /content/static/content/scss/"
"python manage.py collectstatic --no-input --ignore /content/static/content/scss/*"
"python manage.py collectstatic --no-input --ignore content/static/content/scss"
"python manage.py collectstatic --no-input --ignore content/static/content/scss/"
"python manage.py collectstatic --no-input --ignore content/static/content/scss/*"
"python manage.py collectstatic --no-input --ignore /content/scss"
"python manage.py collectstatic --no-input --ignore /content/scss/"
"python manage.py collectstatic --no-input --ignore /content/scss/*"
"python manage.py collectstatic --no-input --ignore content/scss"
"python manage.py collectstatic --no-input --ignore content/scss/"
Here are the commands that DO work:
"python manage.py collectstatic --no-input --ignore content/scss/*" <- best
"python manage.py collectstatic --no-input --ignore content/scss*"
The absolute key to understanding this is to read this ten times:
You need to find the path from static directories, not project
root.
The take-away is:
- you don’t need a leading forward slash at the start of the path
- the path is relative from your static directories
- [Django]-Django nested transactions – “with transaction.atomic()” — Seeking Clarification
- [Django]-How to make a PATCH request using DJANGO REST framework
- [Django]-Access request in django custom template tags
Source:stackexchange.com