SQLite-Database

Hello!
I am starting with tryton and would like to have a simple sqlite-database for the very beginning. Unfortunately, I don’t seem to be able to get up and running.

I have installed tryton 4.6.5 from the Ubuntu repos on Ubuntu 18.04.
From what I can read in the manual, sqlite should be the default option for the data-backend, so no more configuration needed, right?

trytond is running in the background, so I start tryton. This gives me the possibility to connect to demo.4.6.tryton.org, which works just fine.
However, I cannot create a new database, neither from the login manager nor do I find an option to do so from the command line.

Please help: how can I ‘connect’ to a local, empty sqlite database?

Thanks!

SQLite is there only to support the development for quick testing.
So I suggest you to start directly by using postgresql.
Here is the documentation to setup the database.
Remarks to create the database:

  • with SQLite, you must create an empty file in the database path,
  • with PostgreSQL, you must run the command createdb.

Thank you for the clarification!

Regarding the path: I tried that. I set the path property to my own home directory and created both ‘tryton.db’ and ‘tryton.sqlite’ (both empty). Then in the login manager, I set host to ‘localhost’, database to ‘tryton’ and leave the user name empty. When I try to connect I get a python traceback claiming that ‘tryton.sqlite’ is missing?!

I’ll try the PostgreSQL variant, though…

You must initialize the database with trytond-admin as describe in the documentation.
The user name created by the initialization is admin and the password will be asked by trytond-admin.

Somehow I manage to make a big mess out of this.

I

  • installed postgresql, created a user with the power to create databases, created database ‘testdb’
  • changed /etc/tryton/trytond.conf -> [database] uri = postgresql://‘user-from-above’:‘according-password’@localhost/
  • started trytond from console (as normal user)
  • in a new console issued ‘trytond-admin -c /etc/tryton/trytond.conf -d testdb --all’ to initialize database

BUT: I get another traceback with final error:
‘OSError: Database “testdb.sqlite” doesn’t exist!’

This seems strange to me. Why is trytond-admin trying to access an sqlite-database here?

Are you sure that the configuration file is readable by the user running trytond-admin?
Otherwise please provide the full output of the command.

Ah, indeed. trytond.conf wasn’t readable by my user. After adding myself to the ‘tryton’ group setting up a database works now.

Thank you!

I think we should consider giving appropriate error messages. If the configuration file is not found or readable I think trytond should not start, instead of starting with some default values.

We follow standard Python library on this and I think they are right.

And more over we inform about the files really used.

In my case trytond didn’t notify me of failing to access the configuration file, I think. At least, I haven’t found any notice, even after enabling verbose output.

Maybe it would be a good idea to print any such message to stderr ? It would have helped me greatly!

It would have if you run it in verbose mode.

Maybe I’m mistaken here, but it seems I don’t get any warnings, even when enabling verbose output.

What I try:

  • kill trytond
  • remove /etc/tryton/trytond.conf
  • invoking trytond with: ‘trytond -v -c /ect/tryton/trytond.conf’

While I do get some output, the only message related to trytond.conf is:

20715 140622628394816 [2018-08-28 09:41:16,693] INFO trytond.config using  as configuration files

This output is obtained regardless if trytond.conf is available or not. Of course it’s possible I overlook something here, but I don’t see any message I would interpret as ‘no configuration file found’…

I submitted Issue 7690: Log when not all configuration are loaded - Tryton issue tracker

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.