Sushi
Sushi

Reputation: 651

One django template not picking CSS, other templates are fine

I have two django templates in my one folder. The template for the url localhost:8000/people picks CSS correctly which is located at /m/css/style.css

The other template for the url localhost:8000/people/some-name in the same folder is trying to retrieve CSS from people/m/css/style.css

Why is this second template not picking CSS like the first one?

My erring second template is like this:

{% extends "base.html" %}

{% block page_title %}{{ entry.name }} | {{ block.super }}{% endblock %}    

{% block main %}
<h1>{{ entry.name }}</h1>
{{ entry.body|linebreaks }}

{% endblock main %}

As you can see there's nothing in the template that could cause problem.

Upvotes: 0

Views: 142

Answers (1)

Surreal Dreams
Surreal Dreams

Reputation: 26380

It looks to me like your templates are looking for a stylesheet located at ../m/css/style.css. That's why the template in /people works - /people/../m/css/style.css refers to /m/css/style.css. However, /people/some-name/../m/css/style.cssrefers topeople/m/css/style.css`, not the desired address.

Make sure the templates are looking for /m/css/style.css - emphasis on the very first / character.

Upvotes: 1

Related Questions