我正在使用 sorl-thumbnail 在我的 django 项目中动态创建缩略图。
这是我的 HTML 代码是:
<html>
<head><title>mypage</title>
<% load thumbnail %}
<div class="logo">
<a href="">
{% thumbnail "http://www.aino.se/media/i/logo.png" "40x40" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
</a>
</div>
</html>
这是我的settings.py
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
.....
'django.middleware.cache.UpdateCacheMiddleware',
"django.middleware.cache.FetchFromCacheMiddleware",
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
.......
"sorl.thumbnail",
)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': 'd:/code/,
}
}
我没有收到任何错误,也没有缩略图!