jazzband / dj-database-url

Use Database URLs in your Django Application.
https://pypi.org/project/dj-database-url/
BSD 3-Clause "New" or "Revised" License
1.48k stars 205 forks source link

Heroku/Django: No module named dj_database_url #147

Closed RandomAnass closed 2 years ago

RandomAnass commented 3 years ago

I am trying to install dj-database-url, I added dj-database-url==0.5.0 to the requirements. Then I got the error : ModuleNotFoundError: No module named 'dj_database_url'.

My code in settings.py : # Heroku: Update database configuration from $DATABASE_URL. import dj_database_url db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env)

To check again I tried both : $ pip3 install dj-database-url and $ pip3 install dj-database-url And I got : Requirement already satisfied: dj_database_url in c:\users\myname\envs\env\lib\site-packages (0.5.0)

Then : $py -3 manage.py shell

import dj_database_url Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'dj_database_url'


I'm using: Python 3.9.2 django 3.2.4

scuerda commented 2 years ago

@RandomAnass Are you still experiencing this issue?

From the error message you posted, Requirement already satisfied: dj_database_url in c:\users\myname\envs\env\lib\site-packages (0.5.0) it looks like you are running on Windows?

Can you share the output of running pip3 list from within your virtualenv?

mattseymour commented 2 years ago

Close as old issue, please open a new issue if you feel it warrents it.

derick-droid commented 1 year ago

Please ensure you are within the virtual environment, then type this command pip install dj-database-url . Setting.py file ensure you import dj_database_url If it fails to work if you are using Visual Studio if you are running the Django project inside a virtual-environment then from view> command palette choose “select python interpreter” then choose the one where your Django is installed or the virtual-env path one

seyhah commented 1 year ago

I have the same problem. I tried all the suggestions posted here, but not work

SanyamGarg12 commented 6 months ago

Facing same issue

SuperiorKe commented 2 months ago

I am facing the same issue in my Django project on windows.