Skip to Content
Menu
This question has been flagged
1 Reply
10128 Views

So I'm trying to start run my Odoo project. This has always worked in the past, but for some reason, afer restarting the host computer, it's giving me an error when I try to start up the project. I didn't change anything related to configuration so I'm stunned as to why it's giving me this error.

Here is the error:

2019-08-06 12:03:34,199 1 INFO ? odoo.sql_db: Connection to the database failed 
odoo_1  | 2019-08-06 12:03:34,202 1 INFO ? werkzeug: 192.168.0.249 - - [06/Aug/2019 12:03:34] "POST /longpolling/poll HTTP/1.1" 500 - 0 0.000 0.007
odoo_1  | 2019-08-06 12:03:34,209 1 ERROR ? werkzeug: Error on request:
odoo_1  | Traceback (most recent call last):
odoo_1  |   File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 205, in run_wsgi
odoo_1  |     execute(self.server.app)
odoo_1  |   File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 193, in execute
odoo_1  |     application_iter = app(environ, start_response)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 409, in app
odoo_1  |     return self.app(e, s)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 128, in application
odoo_1  |     return application_unproxied(environ, start_response)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied
odoo_1  |     result = odoo.http.root(environ, start_response)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1318, in __call__
odoo_1  |     return self.dispatch(environ, start_response)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1291, in __call__
odoo_1  |     return self.app(environ, start_wrapped)
odoo_1  |   File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 599, in __call__
odoo_1  |     return self.app(environ, start_response)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1451, in dispatch
odoo_1  |     self.setup_db(httprequest)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1374, in setup_db
odoo_1  |     httprequest.session.db = db_monodb(httprequest)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1535, in db_monodb
odoo_1  |     dbs = db_list(True, httprequest)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/http.py", line 1502, in db_list
odoo_1  |     dbs = odoo.service.db.list_dbs(force)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/service/db.py", line 375, in list_dbs
odoo_1  |     with closing(db.cursor()) as cr:
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 657, in cursor
odoo_1  |     return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 171, in __init__
odoo_1  |     self._cnx = pool.borrow(dsn)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 540, in _locked
odoo_1  |     return fun(self, *args, **kwargs)
odoo_1  |   File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 608, in borrow
odoo_1  |     **connection_info)
odoo_1  |   File "/usr/local/lib/python3.5/dist-packages/psycopg2/__init__.py", line 126, in connect
odoo_1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
odoo_1  | psycopg2.OperationalError: could not translate host name "db" to address: Name or service not known - - -

My dockerfile


USER root

RUN pip3 install qrcode xlrd==1.2.0 xlwt XlsxWriter
RUN pip3 install --upgrade pip
RUN apt update && apt install -y cups libcups2-dev python3-dev patch && pip3 install pycups
RUN pip install psycopg2-binary
RUN apt-get update

USER odoo

My docker-compose


version: '2'
services:
db:
image: postgres:10
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
odoo:
build: .
depends_on:
- db
ports:
- "80:8069"
volumes:
- ./odoo.conf:/etc/odoo/odoo.conf
- .:/mnt/repo
- ./generator3.py:/opt/.pycharm_helpers/generator3.py

Thanks in advance for any help!

Avatar
Discard
Best Answer

Hi Brent: Your database container may not have started. Type in docker ps and see if the container db has started. 

Avatar
Discard
Author

Hi, the docker container was running. I started the program up today and the it worked, but it doesn't find back my db anymore? any tips?

Author

Scratch that, ended up having to restore my previous backup of the database to make it work. Probably should've taken a snapshot before trying stuff :)

Related Posts Replies Views Activity
1
Mar 24
502
3
Nov 23
15300
3
Nov 24
21041
1
Apr 23
4557
1
Feb 23
862