Odoo启动错误:psycopg2.OperationalError: FATAL: 角色“foo”不存在

Odoo启动错误:psycopg2.OperationalError: FATAL: 角色“foo”不存在

安装后,odooapt似乎无法进入欢迎页:

启动odoo:

nicholas@mordor:~$ 
nicholas@mordor:~$ odoo --xmlrpc-port=8000
2021-05-01 04:32:16,518 81810 INFO ? odoo: Odoo version 14.0-20210430 
2021-05-01 04:32:16,519 81810 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/home/nicholas/.local/share/Odoo/addons/14.0'] 
2021-05-01 04:32:16,519 81810 INFO ? odoo: database: default@default:default 
2021-05-01 04:32:16,639 81810 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports. 
2021-05-01 04:32:16,698 81810 WARNING ? odoo.addons.base.models.res_currency: The num2words python library is not installed, amount-to-text features won't be fully available. 
2021-05-01 04:32:16,721 81810 INFO ? odoo.service.server: HTTP service (werkzeug) running on mordor.saundersconsulting.tech:8000 

尝试访问主页:

nicholas@mordor:~$ 
nicholas@mordor:~$ lynx --dump localhost:8000
                             Internal Server Error

   The server encountered an internal error and was unable to complete
   your request. Either the server is overloaded or there is an error in
   the application.
nicholas@mordor:~$ 

这会产生更多错误。完整日志:

nicholas@mordor:~$ 
nicholas@mordor:~$ odoo --xmlrpc-port=8000
2021-05-01 04:32:16,518 81810 INFO ? odoo: Odoo version 14.0-20210430 
2021-05-01 04:32:16,519 81810 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/home/nicholas/.local/share/Odoo/addons/14.0'] 
2021-05-01 04:32:16,519 81810 INFO ? odoo: database: default@default:default 
2021-05-01 04:32:16,639 81810 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports. 
2021-05-01 04:32:16,698 81810 WARNING ? odoo.addons.base.models.res_currency: The num2words python library is not installed, amount-to-text features won't be fully available. 
2021-05-01 04:32:16,721 81810 INFO ? odoo.service.server: HTTP service (werkzeug) running on mordor.saundersconsulting.tech:8000 
2021-05-01 04:32:39,450 81810 INFO ? odoo.http: HTTP Configuring static files 
2021-05-01 04:32:39,455 81810 INFO ? odoo.sql_db: Connection to the database failed 
2021-05-01 04:32:39,457 81810 INFO ? werkzeug: 127.0.0.1 - - [01/May/2021 04:32:39] "GET / HTTP/1.0" 500 - 0 0.000 0.005
2021-05-01 04:32:39,460 81810 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 312, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 440, in app
    return self.app(e, s)
  File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 124, in application
    return application_unproxied(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 99, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1295, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1263, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py", line 260, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1429, in dispatch
    self.setup_db(httprequest)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1352, in setup_db
    httprequest.session.db = db_monodb(httprequest)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1517, in db_monodb
    dbs = db_list(True, httprequest)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1484, in db_list
    dbs = odoo.service.db.list_dbs(force)
  File "/usr/lib/python3/dist-packages/odoo/service/db.py", line 384, in list_dbs
    with closing(db.cursor()) as cr:
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 675, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 248, in __init__
    self._cnx = pool.borrow(dsn)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 558, in _locked
    return fun(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 624, in borrow
    result = psycopg2.connect(
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  role "nicholas" does not exist - - -

答案1

看起来您错过了 odoo 配置中的数据库相关参数。您需要确保在配置文件中正确设置了以下数据库参数/etc/odoo-server.conf

db_host = <db_host>
db_port = 5432
db_user = <db_username>
db_password = <db_password>

相关内容