views:

581

answers:

3

I am trying to install sorl.thumbnail but am getting the following error message:

'thumbnail' is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module named PIL

This error popped up in this question as well
http://stackoverflow.com/questions/1356334/need-help-solving-sorl-thumbnail-error-thumbnail-is-not-a-valid-tag-library
but the solution offered there is no good for me. The solution was to append the project folder to all imports in the sorl files. I want to keep my apps separate from the project they are in for obvious reasons.

I have placed the sorl folder in my project folder
I have placed 'sorl.thumbnaills' under installed apps
and finally placed {% load thumbnail %} in base.html

$python2.5 
>>>import PIL
>>>import sorl

These work.

Using python2.5, on ubuntu 9.04 with django 1.1 with appengine-patch

To try some other things out i placed in settings.py file:

import sys
sys.path.append("/home/danielle/bu3/mysite/sorl/thumbnail")

But that didnt work either. Some more help would be appreciated ... how should i change my path?

current path (without above mentioned import): ['/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-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']

A: 

(Editing this, since I didn't read carefully enough)

django.templatetags.thumbnail is not, I think, where your thumbnail templatetags should be loading from ... I would think, if you put it in your project folder, it would be myproject.sorl.thumbnail.templatetags.thumbnail.

As for the the:

No module named PIL

Seems that it can't load PIL, even though import PIL works, did you manually install the Python Imaging Library (PIL) - which is usually not present by default on most systems I know.

Have you tried creating a symlink to on your /usr/lib/python2.6/site-packages/ path and attempting to utilize sorl that way? I am using it on Ubuntu without a problem.

thornomad
+1  A: 

Hi,

Is is a typo in your question? You have mis-spelled 'thumbnails' - for the installed apps you have two l's, i.e.

'sorl.thumbnaills'

rather than

'sorl.thumbnails'

if you run sync.db does it return an error?

Adrian
A: 

Hi Adrian,

It seems i only made the typo here on stackoverflow, in settings i have:

INSTALLED_APPS = (
'jquery',
'blueprintcss',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.webdesign',
'django.contrib.flatpages',
'django.contrib.redirects',
'django.contrib.sites',
'appenginepatcher',
'ragendja',
'myapp',
'registration',
'mediautils',
'site_nav',
'pages',
'sorl.thumbnail',
)

I assume the order doesn't matter. I'm trying to run this on app engine so i haven't needed to do a syncdb as that doesn't do anything on app engine.