Skip to content Skip to sidebar Skip to footer

Django Css Attachment

I have gotten it to now work locally thanks to @Selcuk by adding to the bottom of the settings.py STATICFILES_FINDERS & STATICFILES_DIRS. The page works on with stylesheet loca

Solution 1:

Your css directory is under your static directory. You should either use:

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

or put

{% load staticfiles %}

on top of your HTML file, then use

<link href="{% static 'css/stylesheet.css' %}" rel="stylesheet"type="text/css">

Solution 2:

You have to create a static directory for your static files (css, js, etc)

Then, set your static directory in Django settings (STATIC_URL variable)

Eventually, put {% load static %} in the top of your template.

Post a Comment for "Django Css Attachment"