我想在Django中做如何使用块如静态块来集成css和图像文件的方式,我写了html代码以及它的css文件但是当我想要显示它时无法显示它apears on我错了。 这是我的代码
base.html文件:
<!DOCTYPE html>
<html lang="en">
<head>
<title> {% block title %} My Base Template {% endblock %} </title>
<link rel="stylesheet" type="text/css" href="{% static "assets/css/base.css"%}">
</head>
<body>
<div id="page">
<div id="sidebar">
{% block sidebar %}
<ul>
<li><a href="/allVms">List all Servers </a></li>
<li><a href="/FormCreateVm">Create New VM</a></li>
{% endblock %}
</body>
</htlm>
base.css:
body{ text-align:center;}
#page{
width:968px;
text-align:left;
margin:10px auto 20px auto;
background-color:grey;
}
#sidebar{
float:left;
width:280px;
border:1px solid red;
}
#content{
float:left;
width:608px;
border:1px solid red;
padding:18px;
}
settings.py:
...
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = (
('assets','/home/rochdi/Desktop/PyStack/static'),
)
...
资产是对从主页到包含css和图像文件夹的静态文件夹的此路径的参考
错误是: