Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-environ DATABASE_URL format

Tags:

python

django

I am using django-environ in my project alongside with postgresql. I have been searching through the docs and found the format for DATABASE_URL to be like this:

DATABASE_URL=psql://user:password:port@database_url/db_name

However, by doing so the output of env.db('DATABASE_URL') is

{'PASSWORD': '', 'HOST': 'user', 'PORT': password, 'NAME': '', 'USER': '', 'ENGINE': 'django.db.backends.postgresql'}

What am I doing wrong here?

like image 373
vladimir.gorea Avatar asked May 15 '26 03:05

vladimir.gorea


1 Answers

You have port in the wrong place in your URL. It's supposed to come after after the hostname:

DATABASE_URL=psql://user:password@host:port/database
like image 154
Nikolas Stevenson-Molnar Avatar answered May 16 '26 15:05

Nikolas Stevenson-Molnar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!