Django Heroku - ModuleNotFoundError: No module named 'django_heroku'
Asked Answered
D

4

11

I am deploying on heroku a website but I am experiencing some issue. My project is called mysite-project.

I did the following:

1) Create a Procfile containing:

web: gunicorn mysite-project.wsgi

at the base root of my project (same level where manage.py is).

2) app/settings.py

import django_heroku at the top

django_heroku.settings(locals()) at the bottom of settings.py

3)

pip install gunicorn
pip install django-heroku
pip freeze > requirements.txt

4) If I run python manage.py runserver I get:

ModuleNotFoundError: No module named 'django_heroku'
Dray answered 8/8, 2019 at 15:27 Comment(0)
D
16

There was a problem with:

pip install django-heroku

It was not fully installed because thee was a problem with psycopg2 that was not installed. To install psycopg2, run:

pip install psycopg2

Then you can run pip install django-heroku and the error disappeared.

You can also try installing:

pip install psycopg2-binary

if the error persists

Dray answered 8/8, 2019 at 17:1 Comment(4)
I get the following error while trying to install psycopg2 : error: command 'gcc' failed with exit status 1 I'm using Mac running Catalina.Bubalo
@Bubalo Please check : #11095218Dray
@Dev_mjm, I, too, cannot install django-heroku because I need to install psycopg2. Installing psycopg2-binary works, but not if you want to install django-heroku. I'm on macOS SierraHaller
How is this an answer? He is asking you for the solution with Heroku deployment..Ladino
E
1

I had the same problem as well. I have psycopg2 installed. (for postgres)

Installing 'psycopg2- binary' solved my problem.

Ettaettari answered 3/4, 2021 at 16:31 Comment(0)
M
0

For me, the error was due to adding django-heroku to installed apps in settings.py..,removing it solved the issue.

Morrill answered 31/10, 2020 at 17:11 Comment(0)
D
0

For PIP:

pip 2

pip install django-heroku

pip 3

pip3 install django-heroku

For Anaconda:

conda install -c conda-forge django-heroku
Desimone answered 29/5 at 9:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.