Heroku Django 安装枕头

时间:2021-04-29 08:33:06

标签: python django heroku pip python-imaging-library

我对 Heroku 和 Pillow 有问题 我用 django 开发了一个应用程序,我有一个带有 ImageField 的列 在 heroku 中部署期间,我收到了一条关于使用 pip 安装枕头的错误消息。

错误信息:

product.Profile.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".

django 模型:

class Profile(models.Model):
     user = models.OneToOneField(User, on_delete=models.CASCADE)
     image = models.ImageField(null=True)

你有办法解决我的问题吗? 谢谢

1 个答案:

答案 0 :(得分:0)

您是否在 Pillow 中添加了 requirements.txt

Pillow 是 ImageField 所必需的。

如果您没有在 Pillow 中添加 requirements.txt,请添加以下行:

Pillow