1

django-crispy-forms is present in requirements.txt (added using 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 run pip freeze

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

So, this leads to Application Error on heroku deploy and the heroku logs --tail gives ModuleNotFoundError: No module named 'crispy_forms'

Hema Chandran
  • 173
  • 2
  • 9
  • notice that the error gives you a value of `crispy_forms`, not `django-crispy-forms`. I bet this why you have this error. If that doesn't work, please send some message – zot8 Sep 02 '20 at 14:39
  • Make sure you've committed and pushed your changes to `requirements.txt`. – Alasdair Sep 02 '20 at 14:39
  • @zot8 is there any way to make it right? – Hema Chandran Sep 02 '20 at 14:40
  • @Alasdair Yes, changes are committed and pushed. – Hema Chandran Sep 02 '20 at 14:41
  • @zot8 you *do* import [`crispy_forms`](https://github.com/django-crispy-forms/django-crispy-forms/tree/master/crispy_forms) – Alasdair Sep 02 '20 at 14:41
  • yeah, I understand that, but that's not an `ImportError`, it's a `ModuleNotFoundError`. @HemaChandran, can you run `heroku run pip freeze` again to see what's really installed on Heroku? Also, maybe you need to run some migrations again. Just follow the steps you've done before, and make sure you're pushing the right `requirements.txt` file. – zot8 Sep 02 '20 at 14:48
  • Just now updated the requirements.txt and pushed both origin and heroku. But the problem still continues – Hema Chandran Sep 02 '20 at 14:58
  • did you tried heroku run pip install django-crispy-forms ? manually . Hope so it will fix problem @HemaChandran – gamer Sep 02 '20 at 17:38
  • Yeah, I did @gamer – Hema Chandran Sep 03 '20 at 08:18

1 Answers1

0

// Please see my answer here: https://stackoverflow.com/a/64922610/1965726

I had the same error. I had to put "crispy_forms" in double-quotes and then try to re-import with pip install django-crispy-forms. This solved it for me.

It turns out the first time I did a 'pip install' I was not in my (env) virtual environment, so I assumed I had installed it successfully.

pip freeze > requirements.txt:

asgiref==3.3.1
Django==3.1.3
django-crispy-forms==1.10.0
pkg-resources==0.0.0
pytz==2020.4
sqlparse==0.4.1
bc1984adam
  • 173
  • 1
  • 9