Django Collectstatic Django.How

Author avatar wrote on 30/05/2022

Collectstatic collects all static files inside all apps and put a copy inside the static directory declared in settings.py
eg: confing/static/img/photo.jpg –> static/img/photo.jpg
Important in production (when debug is false) because they will be served from that folder

python manage.py collectstatic --noinput

Some commonly used options are:

Do NOT prompt the user for input of any kind.
--noinput, --no-input
Ignore files, directories, or paths matching this glob-style pattern. Use multiple times to ignore more. When specifying a path, always use forward slashes, even on Windows.
--ignore PATTERN, -i PATTERN
Do everything except modify the filesystem.
--dry-run, -n
Clear the existing files before trying to copy or link the original file.
--clear, -c
Create a symbolic link to each file instead of copying.
--link, -l
Don’t call the post_process() method of the configured STATICFILES_STORAGE storage backend.
--no-post-process
Don’t ignore the common private glob-style patterns ‘CVS’, ‘.*’ and ‘*~’.
--no-default-ignore
For a full list of options, refer to the commands own help by running:
$ python manage.py collectstatic --help
Resources
CRUDgen Django CRUD generator