Heroku Django 安装枕头

Heroku Django install pillow

我对 Heroku 和 Pillow 有疑问 我用 django 开发了一个应用程序,我有一个带有 ImageField 的列 在 heroku 中部署期间,我收到 pillow install with 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)

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

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

Pillow 是 ImageField 所必需的。

如果您没有在 requirements.txt 中添加 Pillow 添加此行:

Pillow