Sitemap

python manage.py collectstatic

1 min readFeb 9, 2023

--

The collectstatic command in Django is used to collect all the static files used by your Django project and put them in a single location for use in production.

Static files in Django are typically things like images, CSS files, and JavaScript files that are used to build the look and functionality of a web site. When you run the collectstatic command, Django collects these files from various locations in your project and puts them in a single directory, which is typically served by a web server in production.

Get Ritik karma’s stories in your inbox

Join Medium for free to get updates from this writer.

The collectstatic command is used as follows:

python manage.py collectstatic

By default, the collected static files will be placed in a directory called staticfiles in your project's root directory. You can specify a different location for the collected files using the --destination option.

It’s important to note that the collectstatic command should not be run in development; instead, Django uses the django.contrib.staticfiles app to handle serving static files during development, which avoids the overhead of running the collectstatic command.

--

--