Im trying to integrate sentry in tryton, but when I start the service with trytond --logconf trytond-logconf.cfg as says in: sentry-tryton · PyPI I have the following problem:
ERROR:tryton.common.common:Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/tryton/gui/main.py", line 249, in do_activate
common.Login()
File "/home/user/.local/lib/python3.10/site-packages/tryton/common/common.py", line 978, in __init__
func(parameters)
File "/home/user/.local/lib/python3.10/site-packages/tryton/rpc.py", line 85, in login
result = connection.common.db.login(username, parameters, language)
File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
return self.__send(self.__name, args)
File "/home/user/.local/lib/python3.10/site-packages/tryton/jsonrpc.py", line 296, in __request
raise Fault(*response['error'])
tryton.jsonrpc.Fault: Database '/home/user/db/mydatabase.sqlite' doesn't exist!
Fault: Database '/home/user/db/mydatabase.sqlite' doesn't exist!
Usually I start the service by calling the trytond.conf file:
And now as I dont specify this file tryton is looking for a sqlite database for default,
So, how could I start tryton calling both files? or how could I tell tryton which is my database in trytond-logconf.cfg?
I already tried to call trytond-logconf.cfg in trytond.conf with something like this:
[logconf]
#File where the server print logs
logconf = /home/user/repository/trytond-logconf.cfg
I have no database if I try to start tryton this way.
Console:
Traceback (most recent call last):
File "/home/user/repository/trytond/trytond/wsgi.py", line 118, in dispatch_request
return endpoint(request, **request.view_args)
File "/home/user/repository/trytond/trytond/protocols/dispatcher.py", line 86, in root
return methods[request.rpc_method](request, *request.rpc_params)
File "/home/user/repository/trytond/trytond/protocols/dispatcher.py", line 107, in db_list
with Transaction().start(
File "/home/user/repository/trytond/trytond/transaction.py", line 105, in start
database = backend.Database().connect()
File "/home/user/repository/trytond/trytond/backend/sqlite/database.py", line 350, in connect
self._conn = sqlite.connect(
sqlite3.OperationalError: unable to open database file
It still use the default sqlite backend. So I guess the trytond.cfg file is not loaded (should see in the log which configuration files are loaded). This may be because the path is wrong or the syntax is wrong.
trytond.conf is fine as I can start tryton with trytond -c trytond.conf and it works fine, but when I add --logconf option, it becomes the only loaded file: 236825 140276763607488 [2023-10-10 07:31:10,284] INFO server using /home/user/repository/trytond-logconf.cfg as logging configuration file
Im also using tryton 6.0 I dont know if it matters.
So I think there is a problem in sentry_tryton package.
I see that it is importing the trytond.backend at the start so probably the module is loaded before the tryton configuration is activated so it sets to the default backend to SQLite (even if the configuration is loaded later).