我正在尝试安装 sorl.thumbnail 但收到以下错误消息:
“缩略图”不是有效的标签库:无法从 django.templatetags.thumbnail 加载模板库,没有名为 PIL 的模块
这个问题也出现了这个错误,
需要帮助解决 sorl-thumbnail 错误:“'thumbnail' 不是有效的标签库:”
但是提供的解决方案对我没有好处。解决方案是将项目文件夹附加到 sorl 文件中的所有导入。出于显而易见的原因,我想将我的应用程序与它们所在的项目分开。
我已将 sorl 文件夹放在我的项目文件夹中
我已将“sorl.thumbnaills”放在已安装的应用程序下
,最后将 {% load thumbnail %} 放在 base.html
$python2.5
>>>import PIL
>>>import sorl
这些工作。
使用 python2.5,在 ubuntu 9.04 和 django 1.1 和 appengine-patch
要尝试一些其他的东西,我放在 settings.py 文件中:
import sys
sys.path.append("/home/danielle/bu3/mysite/sorl/thumbnail")
但这也没有用。一些更多的帮助将不胜感激......我应该如何改变我的路径?
当前路径(没有上述导入):['/home/danielle/bu3/mysite', '/home/danielle/bu3/mysite/common', '/home/danielle/bu3/mysite/common/appenginepatch/appenginepatcher/ lib', '/home/danielle/bu3/mysite/common/zip-packages/django-1.1.zip', '/home/danielle/bu3/mysite/common/appenginepatch', '/usr/local/google_appengine', '/usr/local/google_appengine/lib/antlr3', '/usr/local/google_appengine/lib/yaml/lib', '/usr/local/google_appengine/lib/django', '/usr/local/google_appengine/lib /webob', '/home/danielle/bu3/mysite', '/usr/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg', '/usr/lib/python2.5 /site-packages/ZopeSkel-2.10-py2.5.egg', '/usr/lib/python2.5/site-packages/virtualenv-1.3.2-py2.5.egg', '/usr/lib/python2 .5/site-packages/pip-0.3.1-py2.5.egg'、'/usr/lib/python2.5/site-packages/virtualenvwrapper-1.12-py2.5.egg'、'/usr/lib/ python2.5/site-packages/PyYAML-3.08-py2.5-linux-i686.egg','/usr/lib/python2.5/site-packages/xlutils-1.3.0-py2.5.egg', '/usr/lib/python2.5/site-packages/errorhandler-1.0.0-py2.5.egg', '/usr/lib/python2.5/site-packages/xlwt-0.7.1-py2.5 .egg', '/usr/lib/python2.5/site-packages/xlrd-0.7.0-py2.5.egg', '/usr/lib/python2.5/site-packages/Fabric-0.0.9 -py2.5.egg','/usr/lib/python2.5/site-packages/multitask-0.2.0-py2.5.egg','/usr/lib/python2.5/site-packages/logilab .pylintinstaller-0.15.2-py2.5.egg', '/usr/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg', '/usr/lib/python2.5 /site-packages/clonedigger-1.0.9_beta-py2.5.egg', '/usr/lib/python2.5/site-packages/yolk-0.4.1-py2.5.egg', '/usr/lib/python2.5/site-packages/MySQL_python-1.2.3c1-py2.5-linux-i686.egg', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5 /lib-dynload'、'/usr/local/lib/python2.5/site-packages'、'/usr/lib/python2.5/site-packages'、'/usr/lib/python2.5/site-包/数字','/usr/lib/python2.5/site-packages/PIL','/usr/lib/python2.5/site-packages/gst-0.10','/var/lib/python-support /python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0', '/usr/lib/ python2.5/site-packages/wx-2.8-gtk2-unicode']鸡蛋','/usr/lib/python2.5','/usr/lib/python2.5/plat-linux2','/usr/lib/python2.5/lib-tk','/usr/lib/ python2.5/lib-dynload'、'/usr/local/lib/python2.5/site-packages'、'/usr/lib/python2.5/site-packages'、'/usr/lib/python2.5 /site-packages/Numeric'、'/usr/lib/python2.5/site-packages/PIL'、'/usr/lib/python2.5/site-packages/gst-0.10'、'/var/lib/ python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0', '/usr /lib/python2.5/site-packages/wx-2.8-gtk2-unicode']鸡蛋','/usr/lib/python2.5','/usr/lib/python2.5/plat-linux2','/usr/lib/python2.5/lib-tk','/usr/lib/ python2.5/lib-dynload'、'/usr/local/lib/python2.5/site-packages'、'/usr/lib/python2.5/site-packages'、'/usr/lib/python2.5 /site-packages/Numeric'、'/usr/lib/python2.5/site-packages/PIL'、'/usr/lib/python2.5/site-packages/gst-0.10'、'/var/lib/ python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0', '/usr /lib/python2.5/site-packages/wx-2.8-gtk2-unicode']5/site-packages'、'/usr/lib/python2.5/site-packages/Numeric'、'/usr/lib/python2.5/site-packages/PIL'、'/usr/lib/python2.5 /site-packages/gst-0.10'、'/var/lib/python-support/python2.5'、'/usr/lib/python2.5/site-packages/gtk-2.0'、'/var/lib/ python-support/python2.5/gtk-2.0', '/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode']5/site-packages'、'/usr/lib/python2.5/site-packages/Numeric'、'/usr/lib/python2.5/site-packages/PIL'、'/usr/lib/python2.5 /site-packages/gst-0.10'、'/var/lib/python-support/python2.5'、'/usr/lib/python2.5/site-packages/gtk-2.0'、'/var/lib/ python-support/python2.5/gtk-2.0', '/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode']