I am trying to add images to my models in my Django application.
models.py
class ImageMain(models.Model):
"""This is the Main Image of the product"""
product = models.ForeignKey(Product)
photo = models.ImageField(upload_to='products')
In development mode, every time I try to upload an image using the Django admin, I keep getting:
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
The jpg I'm trying to download can be viewed using os X Preview to make it look real.
The problem seems to be that the Python image library does not recognize it as an image. Why does this happen with a valid image?
PIL is installed, verified through the Django shell.
source
share