Why can't I upload jpg files to my Django app via admin/?

后端 未结 9 1931
借酒劲吻你
借酒劲吻你 2020-12-16 14:16

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         


        
相关标签:
9条回答
  • 2020-12-16 14:45

    I had a similar problem and i had cleared it with referring below link:

    http://osqa.sjsoft.com/questions/96/why-is-there-no-jpegpng-decoder-when-i-pip-install-pil-on-ubuntu

    0 讨论(0)
  • 2020-12-16 14:46

    just do
    sudo easy_install PIL

    this will install PIL specific to your os. please make sure that the egg file generated in /usr/local/lib/python2.6/dist-packages/ is having egg information (because when i did the same, egg file was not correct). If not then just rename the PIL-build-specific-name to PIL and add a PIL.pth file in the dist-packages folder. write PIL in the PIL.pth file and you are done

    0 讨论(0)
  • 2020-12-16 14:48

    I had this problem although on Linux not Mac, so might not be able to give too specific info. However you might need libjpeg-devel too (if there is a correspondent for Mac).

    Also make sure to purge your current PIL installation completely from the system. And after you are sure libjpeg is installed properly then reinstall PIL with build_ext -i. Then run PIL's selftest.py to check if it gives the JPEG error.

    0 讨论(0)
提交回复
热议问题