Skip to content

Instantly share code, notes, and snippets.

@chrislkeller
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrislkeller/adcc78b887bb626c4522 to your computer and use it in GitHub Desktop.
Save chrislkeller/adcc78b887bb626c4522 to your computer and use it in GitHub Desktop.

In django template, I am linking to css like this: <link href="..{% static 'css/style.css' %}" media="screen" rel="stylesheet" type="text/css" />

The baked output gives me exactly what I asked for which is: <link href="../static/css/main-foundation-style-v3.css" media="screen" rel="stylesheet" type="text/css" />

That works fine for each BuildableDetailView that is baked but requires me to change the path on the BuildableListView` to <link href="static/css/style.css" media="screen" rel="stylesheet" type="text/css" />

I do not have the optional build_path set in the BuildableListView class.

Also relevant: STATIC_ROOT = os.path.join(SITE_ROOT, "public", "static")

@palewire
Copy link

palewire commented Feb 4, 2015

So am I reading this right that, basically {% static %} is not properly working and failing to return your STATIC_ROOT path to the template?

@chrislkeller
Copy link
Author

I think after doing more research I just need to learn more about what it is I'm trying to do...

Assuming the project is baked like ...

build_dir
- index.html
- detail_1
- index.html
- static

Using ..{% static 'css/style.css' %} means that build_dir/detail_1/index.html finds the files in build_dir/static just fine. But build_dir/index.html is looking for a directory above build_dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment