← All notes

Django staticfiles finds and serves CSS, JavaScript, and images

Answer: Django calls extra site files such as images, JavaScript, and CSS "static files." The django.contrib.staticfiles app helps you manage them.

Project setup

Include django.contrib.staticfiles in INSTALLED_APPS and set STATIC_URL (for example "static/"). Store files in a static folder inside each app, for example my_app/static/my_app/example.jpg. In templates, the static tag builds the URL for a relative path.

During development, runserver will serve these files automatically when DEBUG is True. That method is unsuitable for production.

Finders

A finder maps a relative path to an absolute file path. FileSystemFinder uses the STATICFILES_DIRS setting. AppDirectoriesFinder looks in each installed app's static directory.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Django documentation and source (django/django): Copyright (c) Django Software Foundation and individual contributors; BSD-3-Clause (https://raw.githubusercontent.com/django/django/stable/6.1.x/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Django docs, Managing static files, BSD-3-Clause (django/django); Django source, django.contrib.staticfiles.finders, BSD-3-Clause (django/django). Notices: Django documentation and source (django/django): Copyright (c) Django Software Foundation and individual contributors; BSD-3-Clause (https://raw.githubusercontent.com/django/django/stable/6.1.x/LICENSE).

Cite this

Permanent ID: iil:note:rcd4jjhq

iinventedlight. 2026. "Django staticfiles finds and serves CSS, JavaScript, and images." iinventedlight Library, iil:note:rcd4jjhq, version of 2026-11-10. https://iinventedlight.com/library/notes/django-static-files/. License: CC-BY-4.0.

@misc{iil_note_rcd4jjhq,
  author = {{iinventedlight}},
  title = {{Django staticfiles finds and serves CSS, JavaScript, and images}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-10},
  url = {https://iinventedlight.com/library/notes/django-static-files/},
  note = {Permanent ID iil:note:rcd4jjhq. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/django-static-files.md.