1

I have looked everywhere but have not found a problem similar to this.

I am trying to make a simple project in Django but there is a problem with static files. I have put two folders in the STATIC_DIRS tuple and I use the collectstatic command to collect them to /static/ folder. The problem is that there is no 404 error for the css file I included but it does not show up in chrome's developer's tools or affect the webpage in any way.

EDIT: I am on a dev server and I include the css files in a template. I don't know which parts of the project are suspect since the css file does not produce an error. I know Django is being found in the static dir successfully because if I change the name of the css file I get a 404. Here is my settings.py file and where I include it in the template.

https://github.com/Ballaw/Twithub/blob/master/Twithub/settings.py https://github.com/Ballaw/Twithub/blob/master/Twithub/assets/templates/base.html

You can find the files the project here. https://github.com/Ballaw/Twithub

Any help would be greatly appreciated!

SOLVED: When including css files in link tags, make sure rel field is set to stylesheet and not stylesheet/css. Major props to Bootvis for discovering this.

3
  • 1
    I don't mean to be rude, but you can't expect people to trawl through your project to try and fix it for you. Post up the relevant parts of your settings. Are you on a production or dev server i.e. are the files being server by django or a webserver. How have you included the css in the template etc. Commented Feb 11, 2012 at 19:08
  • I wasn't expecting anyone to drudge through my stuff. I was hoping this is a problem someone has run across and they might need to glance at something for confirmation. Commented Feb 11, 2012 at 20:11
  • I've updated my answer and have it working on my personal server. Would you mind editing your question to be more general so others users can use it too? I was thinking about just showing the head section of your html and mentioning that w-getting the file does work. Phrased that way the answer would just be: fix your link-tag. I'm quite surprised Chrome (and Firefox) are so strict on what is in there and I guess other people will find the question and answer useful. Commented Feb 12, 2012 at 12:50

2 Answers 2

1

It seems that the problem is in the link-tag. This

<link rel="stylesheet/less" type="text/css" 
     href="{{ STATIC_URL }}css/bootstrap.css">`

should be:

<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/bootstrap.css">
Sign up to request clarification or add additional context in comments.

1 Comment

I thought for sure that would be it, but no luck after changing less to css. The wget succeeded so now I am even more confused. Clearing the browser's cache didn't help either.
1

It's also possible that your browser is simply caching the old css file - how it was before you made changes. Try clearing your browser's cache or using a different browser and see if it makes a difference?

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.