Settings

Theme

Ask HN: How to run test in Django with remote PostgreSQL DB?

1 points by boyanpro 9 years ago · 0 comments · 1 min read


I have remote DB which works perfectly fine with the app. But when I run tests I have these two errors:

RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the default database instead. RuntimeWarning

and

psycopg2.OperationalError: cannot drop the currently open database

I have postgres database on remote posgres and user of the production database also have these roles on postgres db: Superuser, Create role, Create DB. Also I added line to pg_hba.conf to allow remote connection for this user.

I saw this repo here which indicates that I am not lonely in this issue: https://github.com/cnk/d110example

Also there are couple of stackoverflow questions raised, but non of the suggested solutions helped me.

Any ideas?

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection