내 urls.py 라인이 있습니다장고 정적 파일
STATIC_DOC_ROOT = os.path.join(os.path.dirname(__file__),'static').replace('\\','/')
을 내가 갈 때/내 페이지의 모든 그냥 잘 작동 : 내 설정에서
if settings.DEBUG==True:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_DOC_ROOT})
)
는 다음과 같이 파일 . 그리고 다른 페이지로의 링크를 클릭하면 404 오류 때문에 CSS가 적용되지 않습니다. 그는 해당 URL에서 CSS 파일을로드하려고 시도합니다.
http://localhost:8000/show/sth/static/style.css
다음은이 방법을 내가 URL/링크가 및 CSS가 작동하지 않는이 하나의 템플릿에서 바로 작동
(r'^show/(?P<subject>[^/]+)/(?P<title>[^/]+)$','show'),
내 urls.py입니다. 이 매개 변수가 뭔가를 엉망으로 만든 것 같습니다. 이것이 실패한 이유는 무엇입니까? 다음은 내 템플릿 코드 :
{% extends "szkielet.html" %}
{% block tresc %}
<div id="content">
<div class="post">
<h2 class="title">{{ notatka.tytul }}</h2>
<p class="meta"><span class="author">{{ notatka.user.name }}</span> <span class="date">July 07, 2010</span> <span class="links"><a href="#" title="">Comments</a></span></p>
<div class="entry">
<p>{{ notatka.tresc }}</p>
</div>
</div>
</div>
{% endblock %}
Szkielet.html - 내 기본
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Perfect Blemish by Free CSS Templates</title>
<link href="{{ MEDIA_URL }}style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
입니다 여기에 CSS에 대한 책임 부분은 하나의 스타일 시트입니다.
나는 모든 템플릿을 확장하기위한 기본 html을 가지고 있다고 생각합니다. 이 페이지를 확장하는 것을 잊어 버렸습니까? –
연장 부분이 있습니다. 문제는 하나의 템플릿에서 css가 URL이 잘못된 경로 – John