开发者

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 localh开发者_如何转开发ost: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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜