0

enter image description here

My django project is pictured above:

I'm trying to set a path to my css using:

<link href="{% static "css/bootstrap.min.css" %} rel="stylesheet">

In my settings.py I have:

STATIC_URL = '/static/'

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR,  'templates'),

When I run the project I get:

TemplateSyntaxError at /index/

Invalid block tag: 'static'

What am I doing wrong?

1
  • Do you have {% load staticfiles %} Commented Dec 4, 2014 at 17:05

1 Answer 1

2

The problem maybe is: You don't loaded tag for staticfiles.

{% load staticfiles %}

You should load staticfiles first, and then you can use static tag.

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

1 Comment

Make sure you put this at least above the first time you use {% static %}. Also note that you will need to use {% load staticfiles %} in each template that you want to use the {% static %} tag.

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.