Home > Back-end >  settings.DATABASES is improperly configured. Please supply the NAME or OPTIONS['service']
settings.DATABASES is improperly configured. Please supply the NAME or OPTIONS['service']

Time:04-17

i develop an app on heroku server when i finishing setting up my AWS RDS POSTGRESQL and run my migrations and migrate successeful without any error. its throws me an error.

the error

settings.DATABASES is improperly configured. Please supply the NAME or OPTIONS['service'] 
value.

i did'nt run heroku run python manage.py migrate which i think is not the problem. I'm using heroku server and i setup everything its needs for aws rds for postgresql. i get this error in production server not on localhost, because its working perfect on localhost.

Database configurations in settings.py file

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': '',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '5432',
    }
}

the error when running heroku run python manage.py makemigrations

 File "/app/.heroku/python/lib/python3.10/site- 
packages/django/db/backends/postgresql/base.py", line 159, in 
get_connection_params
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is 
improperly configured. Please supply the NAME or OPTIONS['service'] 
value.

is anybody who face the same problem before me please. Thanks

CodePudding user response:

I have solve my problem in heroku settings under DATABASE_URL.

the old one:

postgresql://username:password@awsrdshost

The new one:

postgresql://username:password@awsrdshost:5432/dbname
  • Related