【发布时间】:2015-11-16 14:14:29
【问题描述】:
所以我在我的网站上遇到了一个问题,然后我创建了两个单独的 html 页面。然后我编辑了 urls.py,因此 2 个页面的 url 会有所不同,但如果我这样做,css 将停止工作。我的代码如下,后面会详细解释。
我的 head.html 的一部分
<!-- Bootstrap core CSS -->
<link href="../../static/textchange/index.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../../static/textchange/jumbotron.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="../../static/textchange/index.js"></script>
我如何在每个 html 页面上包含 head
{% include "textchange/head.html" %}
导致问题的两个网址
url(r'^results/(?P<uisbn>(\w)+)/(?P<uuser>(\w)+)$', views.contactpost, name="contactpost"),
url(r'^results/(?P<uisbn>(\w)+)/(?P<uuser>(\w)+)$', views.contactwish, name="contactwish"),
所以以上是我的网址目前的设置方式,我意识到目前这只会发送到联系人邮件。当我像这样更改网址时:
url(r'^results/(?P<uisbn>(\w)+)/post/(?P<uuser>(\w)+)$', views.contactpost, name="contactpost"),
url(r'^results/(?P<uisbn>(\w)+)/wish/(?P<uuser>(\w)+)$', views.contactwish, name="contactwish"),
CSS 对两个页面都停止工作。
最初在我有 2 个页面之前,网址看起来像这样:
url(r'^results/(?P<uisbn>(\w)+)/(?P<uuser>(\w)+)$', views.contact, name="contact"),
Views.py
@login_required
def contactpost(request, uuser, uisbn):
ltextbook = Textbook.objects.filter(isbn = uisbn)
text = ltextbook[0]
luser = User.objects.filter(username = uuser)
quser = luser[0]
post = Posting.objects.filter((Q(user = quser) & Q(textbook = ltextbook)))
posting = post[0]
return render_to_response(
'textchange/contactpost.html',
locals(),
context_instance=RequestContext(request)
)
@login_required
def contactwish(request, uuser, uisbn):
ltextbook = Textbook.objects.filter(isbn = uisbn)
text = ltextbook[0]
luser = User.objects.filter(username = uuser)
quser = luser[0]
wish = Wishlist.objects.filter((Q(user = quser) & Q(textbook = ltextbook)))
wishlist = wish[0]
return render_to_response(
'textchange/contactwish.html',
locals(),
context_instance=RequestContext(request)
)
为什么 CSS 会停止工作?
谢谢。
【问题讨论】: