I\'m trying to add images to my models in my Django app.
models.py
class ImageMain(models.Model):
product = models.ForeignKey(Product)
photo = mo
Django is trying to import PIL from a folder called PIL, but PIL installs itself in a folder called e.g. PIL-1.1.7-py2.6-macosx-10.6-universal.egg, so the import fails - which Django (or PIL ?) seem to interpret as corrupt image.
A simple symlink
host:~ user$ cd /Library/Python/2.6/site-packages
host:site-packages user$ ln -vis PIL-1.1.7-py2.6-macosx-10.6-universal.egg PIL
create symbolic link `PIL' to `PIL-1.1.7-py2.6-macosx-10.6-universal.egg'
has fixed this for me on a Mac OSX 10.6.x MBP.
On Linux machines, the folder might instead be called dist-packages and be underneath /usr/lib/python/ or so, but the idea is the same.
You can often find the folder where python modules are usually installed to as described here.