heroku errors ImportError: No module named crispy_

2019-06-11 11:17发布

问题:

I have a question When I ran this command heroku run python manage.py migrate

I got this error: ImportError: No module named crispy_forms

But on locally every things are doing well but my app is don't to run on Heroku please help me ?

回答1:

you can also do

heroku run pip freeze

that will give you a list of installed pip apps on heroku.. but ya also check your requirements.txt file



回答2:

I had the same issue when running heroku run python manage.py migrate command. Here is what I did and solve the issue:

  • Verify the crispy_forms in the INSTALLED_APPS under settings.py
  • Run pip install --upgrade django-crispy-forms or pip3 install --upgrade django-crispy-forms depends on the Python version you are using (pip3 is for Python version 3 and above)

If the aboves didn't work, try Daniel Roseman's suggestion:

  • Add this line django-crispy-forms==1.6.1 (version number will change so verify yourself here https://github.com/django-crispy-forms/django-crispy-forms/blob/dev/CHANGELOG.md) to requirements.txt file

This helped me and hope this will work for you as well. But don't forget to run (i) git add ., (ii) git commit -m "your comment", and (iii) git push heroku master before running heroku run python manage.py migrate command again.



回答3:

if you haven't already, run this on your heroku platform:

pip install django-crispy-forms

remember that your local dependencies will not be installed automatically on your heroku dynos.