How to set relative url for a css file in Django

Tags: python,css,django

Problem :

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 I have:

STATIC_URL = '/static/'

    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?

Solution :

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.

    CSS Howto..

    How to add number to current CSS width with jQuery

    How to remove a CSS class from all same level table rows When a Row is Selected?

    How to push up text in CSS?

    how can I shape the image size according to its nested box

    Show window inside any web page

    How to auto adjust menus height according to container height

    How to display thick line under header of sub menu using css

    How to show a message box on center of screen?

    How To Set CSS Classes On HTML Tags Which Are Included In The Page With PHP Include's

    How can I swap out text in a text-box by using only CSS mouse related events?

    How to overlap a child element of one div with`display:table-cell` over another div with `display:table-cell?`

    How to define link text color in UIWebView

    how to show images with it's original smoothness in IE

    Codeigniter--add “active” css class to link, how to?

    How to use a custom image for cursor/thumb in html input type range

    HTML/CSS - Input [Text] How to disable the browser from offering suggestings in the Dropdown?

    how to combine widget webapp framework with SEO-friendly CSS and JS files

    How to place a css button in center (horizontal) of four table columns

    How to create a smooth zoom and display an overlay when another HTML element gets hovered?

    how to add items into a CSS based text rotator (similar to news ticker)

    How to create a border gap illusion

    how to apply css on dynamic loaded html content (jquery mobile+backbone+phonegap)

    How can I add another level to this responsive horizontal nav?

    How to recalculate the css url paths when moving it to a different folder

    How to make box container expand when text-field does?

    How to add an icon to bottom right of textareas via CSS?

    How does Gmail prevent overlap for elements that use absolute positioning?

    How do I differentiate between IE versions 6 to 10 using IE CSS Hacks?

    Jquery how to change your website background?

    How to properly float two columns side by side with css