【发布时间】:2014-04-15 20:35:54
【问题描述】:
这是我的settings.py
STATIC_URL = '/static/'
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
我的结构是:
manage.py
myproject
-- __init__.py
-- settings.py
-- urls.py
-- wsgi.py
-- static
----- css
----- img
-------- logo.png
----- scripts
我在我的 html 文件中使用静态标签,如下所示:<img src="{{ STATIC_URL }}img/logo.png">
但是,它是:
[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (logo.png, line 0)
在 Django 1.6.2 版本上我真的无法理解这个问题。
有人可以帮我解决这个问题吗?
提前致谢!
【问题讨论】:
-
您的错误看起来不像 Django 错误...此外,如果您查看呈现页面的源(在您的浏览器中),它试图获取的图像的 URL 是什么?
-
<img src="/static/img/logo.png">
标签: python django django-settings