Ask HN: How to run test in Django with remote PostgreSQL DB?
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.