How to use Pillow with Django

前端 未结 4 1447
借酒劲吻你
借酒劲吻你 2021-02-18 16:44

I installed Pillow and now want to use it on my Django site to allow uploading of images of through my admin page. See previous question.

What changes do I need to make

4条回答
  •  情书的邮戳
    2021-02-18 17:41

    The problem is that imports now work slightly differently with Pillow vs PIL. The differences are described here: http://pillow.readthedocs.org/en/latest/porting-pil-to-pillow.html

    Django has also now been changed to prefer Pillow over PIL, via this ticket (https://code.djangoproject.com/ticket/19934)

    This commit is present in the new Django 1.6a1 release, so the new behaviour will be present in the Django 1.6 release. For now, however, it appears that you can use a new library (initially released May 20, 2013) called Pillow-PIL which will provide a compatibility layer. This can be easily installed with pip via: pip install --pre Pillow-PIL

提交回复
热议问题