1👍
✅
First, configure STATIC_ROOT
and STATIC_URL
in yoursettings.py
:
import os
# Project root is intended to be used when building paths,
# e.g. ``os.path.join(PROJECT_ROOT, 'relative/path')``.
PROJECT_ROOT = os.path.abspath(os.path.dirname(__name__))
# Absolute path to the directory where ``collectstatic``
# will collect static files for deployment.
#
# For more information on ``STATIC_ROOT``, visit
# https://docs.djangoproject.com/en/1.8/ref/settings/#static-root
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static/')
# URL to use when referring to static files.
#
# For more information on ``STATIC_URL``, visit
# https://docs.djangoproject.com/en/1.8/ref/settings/#static-url
STATIC_URL = '/static/'
Then you should be able to use
{% static 'project/css/style.css' %}
which, as far as I know, will take care of compatibility.
Consider reading about managing static files.
Source:stackexchange.com