【发布时间】:2014-06-25 11:28:48
【问题描述】:
我无法使用 StaticFile 进程来反映我的图像。这是我的全局设置:
STATIC_URL = '/static/'
STATICFILES_DIRS = (
('assets', 'C:/Users/dhopkins/PycharmProjects/django_test/static'),
我的base.html:
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% block title %}My base template.{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% static "assets/css/default.css" %}">
</head>
<body>
<div id="page">
</div>
<div id="sidebar">
{% block sidebar %}
<ul>
<li><a href="/articles/all">Articles</a></li>
<li><a href="/admin/">Admin</a></li>
</ul>
{% endblock %}
</div>
<div id="content">
{% block content %}Content goes here!{% endblock %}
<img scr="{% static "images/python-logo.jpg" %}" width="200"/>
</div>
</body>
</html>
我的图像文件夹位于 C:\Users\dhopkins\PycharmProjects\django_test\static\images。 请帮忙。
【问题讨论】:
-
也许问题出在前缀“资产”上?你可以尝试删除它吗?
-
通过删除“资产”,它也不会检测到 css。 Css 设置根本不会通过删除模板来反映模板。
标签: html django python-2.7