【发布时间】:2017-05-22 09:10:33
【问题描述】:
我在 localhost 上运行,但样式表不起作用
这是我的项目设置:
-main
-main
-home
-templates
-home
-index.html
-static
-css
-style.css
我的设置.py:
STATICFILES_DIRS = [
"/static/",
]
STATIC_URL = '/static/'
index.html:
{% load staticfiles %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>My Home Page</title>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}" />
</head>
<body>
<p>My Content</p>
</body>
</html>
这是我的服务器输出的内容:"GET /static/css/style.css HTTP/1.1" 404 1652
怎么了?
【问题讨论】:
标签: python django python-2.7 static django-templates