Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] Excepción al acceder a BD en tests en docker #1

Open
AndresJR opened this issue Jan 7, 2020 · 0 comments
Open

[Error] Excepción al acceder a BD en tests en docker #1

AndresJR opened this issue Jan 7, 2020 · 0 comments

Comments

@AndresJR
Copy link
Owner

AndresJR commented Jan 7, 2020

Tras levantar la aplicación con docker-compose, al intentar correr las pruebas con docker run ./manage.py test se devuelve un fallo que parece estar relacionado con la no accesibilidad del contenedor "db" para la base de datos. Copia del error:

/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py:253: 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.
warnings.warn(
nosetests --verbosity=1
Creating test database for alias 'default'...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 168, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/init.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name "db" to address: Name does not resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant