[Answer]-Point to a custum setting in the template

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

Leave a comment