Tanuj KS
Tanuj KS

Reputation: 165

Rendering CSS with HTML with Django

So I have the file main.html which is being returned unstyled even though I have style.css in /polls/static/polls/style.css

Here is main.html (cut down for simplicity)

{% load static %}<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
  </head>

my settings.py has this for the static URL:

STATIC_URL = '/static/'

Yet it still returns it unstyled while the console gets returned 404 1671:

"GET /polls/static/polls/style.css HTTP/1.1" 404 1671

Here is my directory: Directory

The fix is probably easy I'm just a newbie at Django

Thanks

Upvotes: 0

Views: 271

Answers (1)

Fedor Soldatkin
Fedor Soldatkin

Reputation: 1203

You should add STATICFILES_DIRS to your settings file. Like this:

STATICFILES_DIRS = [os.path.join(BASE_DIR, 'polls/static')]

Upvotes: 2

Related Questions