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.49k stars 205 forks source link

Exception while using the connection string with postgres #186

Closed zugspitze closed 1 year ago

zugspitze commented 2 years ago

Hi, I am getting the following exception when using the connection string.

engine = SCHEMES[url.scheme] if engine is None else engine KeyError: 'postgresql+psycopg2'

Also my connection string starts with postgresql+psycopg2

Can you please suggest me how to fix it? Thanks!

mattseymour commented 1 year ago

Do you have any more context around this issue?

palfrey commented 1 year ago

Two PRs for this:

mattseymour commented 1 year ago

The connector for postgres connections is postgres no need to use the +psycopg connection part. This is because under the hood it uses the same Django postgres connector. I would say we do not support adding aliases and instead improve the error handling. As I see @palfrey has suggested in another message.

palfrey commented 1 year ago

The connector for postgres connections is postgres no need to use the +psycopg connection part. This is because under the hood it uses the same Django postgres connector. I would say we do not support adding aliases and instead improve the error handling. As I see @palfrey has suggested in another message.

Happy for me to merge https://github.com/jazzband/dj-database-url/pull/196 then?

palfrey commented 1 year ago

@zugspitze With the current master branch of this repo, you should now get a better error message, and so should be clear to change the schema to postgres now.