2

I am using flask and Jinja templates. None of my CSS is being applied, except for bootstrap which is being downloaded from an external host.

Here is the line in my base template for my own stylesheet:

<link rel=”stylesheet” type=”text/css” href="{{ url_for('static', filename='style/stylesheet.css') }}">

And then when I open the page in chrome I can follow the link, and it opens up the file successfully. However when I look in the frames I cannot see my stylesheet under the stylesheets section:

enter image description here enter image description here

Here is the request from the server: GET /static/style/stylesheet.css HTTP/1.1" 200 -

It looks likes it's not being recognized as a css file ? I'm not great with web stuff so hopefully this is something simple.

7
  • What does the final HTML look like? Does it include the (expected) correct path to the CSS? Commented Dec 4, 2013 at 10:55
  • Yes, and when I view the source in chrome and follow the link it loads correctly. Commented Dec 4, 2013 at 10:57
  • That sounds unlikely? If the CSS is accessible then it can be loaded separately but also on the HTML page itself. Are you sure the path to the CSS is complete (i.e., / at the beginning, with static etc)? Alternatively, could you look in Chrome's web debugger to see how it returns the file (as text/css or something else)? Commented Dec 4, 2013 at 10:59
  • I also faced this kind of issue sometime back. Try restarting your computer. It worked for me. Commented Dec 4, 2013 at 11:10
  • Tried a restart, no luck unfortunately. Commented Dec 4, 2013 at 11:23

2 Answers 2

1

I have no idea what was happening here. This issue has been ongoing for days.

To fix it I simply copied the line that loads the CSS, saved my project, pasted it back in, and ran the server. Mass confusion.

Sign up to request clarification or add additional context in comments.

2 Comments

This is driving me crazy. I'm hitting the same thing and nothing works, copy-pasting included. Any idea what could be wrong? This seems like such a simple problem :-/
Turns out it was a faulty CCS from bootstrap's site. Odd.
1

For anyone else still having issues with this I found this that suggests the CSS is not being "hard refreshed".

I fixed this issue on my Mac in Chrome by holding down both ⌘ Cmd+⇧ Shift and pressing R.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.