1๐
I guess one way to do this is by creating a context processor.
Create a context_processors.py somewhere in your project
import settings
def css_url(request):
return {'CSS_URL': settings.CSS_URL}
Add the context processor in your settings
CSS_FOLDER_ROOT = "/home/brian/Projects/RaffleThis/RaffleGym/stylesheets/"
CSS_URL = '/css/'
TEMPLATE_CONTEXT_PROCESSORS += (
"django_app.context_processors.css_url",
)
Then you can use something like this in your templates.
<link rel="stylesheet" href="{{ CSS_URL }}<filename.css>" />
๐คRod Xavier
Source:stackexchange.com