'Heroku deploy failed: Couldn't import Django. Are you sure it's installed?

I am trying to deploy my Python app to Heroku. I am using pipenv. I have defined Pipfile:

...
[packages]
django = "*"
...

I defined Procfile:

release: python manage.py migrate
web: gunicorn scrapper.wsgi
clock: python scrapper/scheduler.py

I also added config variable for settings:

DJANGO_SETTINGS_MODULE:         scrapper.settings

When i push my changes to Heroku, deply fails with the following error:

File "manage.py", line 17, in "Couldn't import Django. Are you sure it's installed and " ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?



Solution 1:[1]

Make sure you have Django installed by writing this command :

python -m django --version

if it's not installed you can install it by writing this command :

pip install django              

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ahmad Kahil