Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAleksandar Kosev
4,603 PointsNow that we have the tag available, we can use it in our <link> tag. Use {% static %} to reference the "css/styles
HELP!
{% extends 'base.html' %}
{% load static from staticfiles %}
{% block static %}
<link rel="stylesheet" href="{% static 'css/style.css' %}">
{% endblock %}
{% block content %}
{% for article in articles %}
{{ article.headline }}
{% endfor %}
{% endblock %}
9 Answers
Chris Grazioli
31,225 Points@Aurélien Debord
Try making 'css/styles.css' its been a whie but I think thats what ended up working for this project. For some reason the style sheet is plural??
Quentin Durantay
17,880 PointsTry this:
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}>
{% %} is when you want to execute Python code, {{ }} is when you want to use a Python variable.
Aleksandar Kosev
4,603 PointsNop:/ it is still giving me "Didn't find the correct {% static %}
tag."
Kenneth Love
Treehouse Guest Teacherurl_for
is a Flask macro, not a Django template tag.
Chris Grazioli
31,225 PointsKenneth Love whats the deal here? the grader doesn't seem to accept the correct answer. I thought I copied exactly what the video taught.
<link rel="stylesheet" href="{% static 'css/style.css' %}">
Kenneth Love
Treehouse Guest TeacherDouble check the instructions for the stylesheet's filename.
Chris Grazioli
31,225 Pointsapparently I misspelled it here but in my code it was correct, but still not passing.
Kenneth Love
Treehouse Guest TeacherI just passed it this morning with your code, the correct filename, and importing the static
tag. I'm not sure what could be going wrong outside of those things.
Chris Grazioli
31,225 PointsIt's says Use {% static %} to reference the "css/styles.css" file in the href attribute of the <link> tag. What are we missing?
Kenneth Love
Treehouse Guest Teacher<link rel="stylesheet" href="{% static 'css/style.css' %}">
^
Chris Grazioli
31,225 Points@Kenneth Love thats exactly what I entered, three different times, I even skipped this section and Its spelled out exactly the same as your saying and I'm typing, later on in the course.
Kenneth Love
Treehouse Guest TeacherThe instructions say to link styles.css
(as in more than one style), not style.css
. You misspelled the filename.
Chris Grazioli
31,225 PointsThat's really weird! Spent the day brewing today, I'll take a look again tomorrow, but I tried it both ways several times yesterday and with much Aggravation ito my worked as I explained above.
Aurélien Debord
18,114 PointsHello everybody,
I try this and it does not work. Can you tell me what is wrong ?
<link rel="stylesheet" href="{% static 'css/style.css' %}">
Aurélien Debord
18,114 PointsThanks Chris Grazioli
Chris Grazioli
31,225 PointsSOLVED
<link rel="stylesheet" href="{% static 'css/styles.css' %}"> -- doesn't work but the grader will accept <link rel="stylesheet" href="{% static "css/styles.css" %}"> for some reason
Kenneth Love
Treehouse Guest TeacherI've tested both <link rel="stylesheet" href="{% static 'css/styles.css' %}">
and <link rel="stylesheet" href="{% static "css/styles.css" %}">
and they both pass. Even <link rel="stylesheet" href="{%static'css/styles.css'%}">
is passing.
nasir iqbal
2,546 Pointsthis is the correct answer rel="stylesheet" href="{% static "css/styles.css" %}"> other answers doesnt work for exp <link rel="stylesheet" href="{% static 'css/styles.css' %}">