In this article, we will learn how to fix modulenotfounderror: no module named ‘django_heroku’.
The error occurs when the program forget to install django_heroku module.
Why the error no module named django_heroku occur?
The error no module named django_heroku occur because it is not compatible the installation of psycopg2 with django_heroku module.
When you’re ready, so let’s begin!
Read also: Modulenotfounderror: No Module Named Numpy [SOLVED]
How to Solve no module named django_heroku?
Time needed: 2 minutes
Here are the two steps to fix this no module named django_heroku error.
- Step 1: Install django_heroku packages
If the django_heroku module is not installed the ModuleNotFoundError will occur.
Then to fix this problem we need to install the django_heroku.
We will used the PIP Function:
For the PIP 2: pip install django-heroku
For the PIP 3: pip3 install django-heroku
For the installation of Anaconda, we will use the command:
conda install -c conda-forge django-heroku
After installing the django_heroku module, The error will already be solve.
If not, then we must go to the following solution. - Step 2: Install psycopg2
The Django_heroku it is required to install “psycopg2“, Therefore we need to install the psycopg2 and psycopg2-binary.
We will used the PIP function:
First: pip install psycopg2
Second: pip3 install psycopg2
Third: pip install psycopg2-binary
Fourth: pip3 install psycopg2-binary
For the installation of Anaconda, we will use the command:
conda install -c anaconda psycopg2
conda install -c conda-forge psycopg2-binary - Step 3: Run Django with Python 3
According to django-heroku documentation, “Only Python 3 is supported”.
Which is means we need to run the Django project with Python 3.
We will this command to Run Django with Python 3:
python3 manage.py runserver
Conclusion
To conclude, in this article we already learn all the solutions to fixed or solved modulenotfounderror: no module named django_heroku