【发布时间】:2020-12-21 18:11:04
【问题描述】:
django-crispy-forms 存在于 requirements.txt 中(使用 pip freeze > requirements.txt 添加) requirements.txt
asgiref==3.2.10
autopep8==1.5.4
beautifulsoup4==4.9.1
certifi==2020.6.20
chardet==3.0.4
Django==3.1
django-crispy-forms==1.9.2
feedparser==5.2.1
idna==2.10
Pillow==7.2.0
pycodestyle==2.6.0
python-dateutil==2.8.1
pytz==2020.1
requests==2.24.0
six==1.15.0
soupsieve==2.0.1
sqlparse==0.3.1
toml==0.10.1
urllib3==1.25.10
heroku 运行 pip 冻结
appdirs==1.4.4
asgiref==3.2.10
certifi==2020.6.20
distlib==0.3.1
Django==3.1.1
filelock==3.0.12
gunicorn==20.0.4
pipenv==2018.5.18
pytz==2020.1
six==1.15.0
sqlparse==0.3.1
virtualenv==20.0.31
virtualenv-clone==0.5.4
whitenoise==5.2.0
因此,这会导致 heroku 部署时出现应用程序错误,heroku logs --tail 给出了ModuleNotFoundError: No module named 'crispy_forms'
【问题讨论】:
-
请注意,该错误为您提供了
crispy_forms的值,而不是django-crispy-forms。我敢打赌这就是为什么你有这个错误。如果这不起作用,请发送一些消息 -
确保您已提交更改并将更改推送到
requirements.txt。 -
@zot8 有什么办法让它正确吗?
-
@Alasdair 是的,更改已提交并推送。
-
@zot8 你做 import
crispy_forms
标签: python django heroku deployment