When DEBUG is True (default in development), Django's runserver automatically serves static files using the staticfiles app. This means you don't need extra setup to see CSS or JS files.
STATICFILES_DIRS should be a list or tuple of directories. Using BASE_DIR / 'assets' uses pathlib to join paths correctly.
The staticfiles app must be in INSTALLED_APPS for Django to serve static files in development. collectstatic is only needed for production.
collectstatic copies all static files into a single folder (STATIC_ROOT) for production servers to serve efficiently. In development, Django serves files directly from app folders.
from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = True STATIC_URL = '/static/' if not DEBUG: STATIC_URL = '/assets/'
Since DEBUG is True, the condition 'if not DEBUG' is False, so STATIC_URL remains '/static/'.
