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

[Question] How to specify a 'user' when using postgres socket syntax? #103

Closed elbenfreund closed 6 years ago

elbenfreund commented 6 years ago

As per README it is possible to specify a postgres db via a socket url. What is not clear to me from the example is, how to include the 'user' parameter in this specific syntax. Any pointers would be most appreciated.

sigmavirus24 commented 6 years ago

This is a little light on details, but I think I know what you're trying to ask. If I miss the point, please let me know and maybe provide more details.

So, in our README, we describe the URL Schema where postgres://USER:PASSWORD@HOST:PORT/NAME is described as acceptable. It also has a link to this footnote which describes the socket variant of postgres://%2Fvar%2Flib%2Fpostgresql/dbname. In this case we would parse the socket variant with %2Fvar%2Flib%2Fpostgresql as the HOST portion in the example above. That means that postgres://USER@%2Fvar%2Flib%2Fpostgresql/dbname should be valid. If you also need to specify the password then postgres://USER:PASSWORD@%2Fvar%2Flib%2Fpostgresql/dbname should be valid as well.

Please close this if that answers your question

elbenfreund commented 6 years ago

Thanks a lot! :+1: