Polls Tutorial Static CSS

Hi all

I’m working through the polls tutorial, and I get stuck on page 6 - the css doesn’t seem to show on the webpage.


li a {
    color: green;
h1 {
    color: red;

body {
    background: white url("images/background.jpg") no-repeat;


{% load static %}

<!DOCTYPE html>
        <meta charset="UTF-8">
        <title>Polls App</title>
        <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}">

I’m not sure if I’ve put the tag in the right place. I’ve tried putting it at the top of the page under {% load static %} but I get the same result - the html page shows no styles.

Thanks in advance for your help.

As far as I can tell, the syntax in your template looks correct to me. Can you confirm if your CSS file is loading in the browser or not?

If you open up the DevTools (View -> Developer -> Developer Tools if you’re using Chrome), then go to the network tab and reload your page, you should be able to see if the CSS file is loading properly. The response status code for a successful load is a 200. The response will be a 404 if it didn’t load.

If it’s not loading, there are a few things to check.

  1. How are you running the application? With ./manage.py runserver or something else like gunicorn?
  2. Are you running with DEBUG set to True or False?

When doing local development and DEBUG = True, the runserver command should be serving all static assets. If you have DEBUG = False, it won’t serve static assets from the individual Django apps.

1 Like

Hi, had DEBUG = False , changed it to True , and now it’s working. :slight_smile:

Thanks for your help.