Sao not showing database

Hello I am trying to access to a sao tryton in a cloud server I can access to it via desktop, but in the web is impossible to login, because the database is not showing

In the server log this is showing:

1058 140382867453696 [2020-03-04 02:44:50,269] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:44:50] “GET /custom.js HTTP/1.1” 405 -
1058 140382867453696 [2020-03-04 02:44:50,399] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:44:50] “GET /favicon.ico HTTP/1.1” 405 -
1058 140382867453696 [2020-03-04 02:45:07,023] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:45:07] “GET / HTTP/1.1” 200 -
1058 140382867453696 [2020-03-04 02:45:07,168] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:45:07] “GET /custom.js HTTP/1.1” 405 -
1058 140382867453696 [2020-03-04 02:45:07,230] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:45:07] “GET /custom.css HTTP/1.1” 405 -
1058 140382867453696 [2020-03-04 02:45:07,450] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:45:07] “GET /locale/en_US.json HTTP/1.1” 405 -
1058 140382727984896 [2020-03-04 02:45:07,542] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:45:07] “GET /locale/en.json HTTP/1.1” 405 -
1058 140382727984896 [2020-03-04 02:45:07,747] INFO werkzeug 64.32.67.75 - - [04/Mar/2020 02:45:07] “POST / HTTP/1.1” 200 -

My configuration is this:

[database]
uri = postgresql://xxxxxx:********@x.x.x.x/
path = path/sug_tryton/htdocs/

list=True
language=es

[web]
root = path/sao_tryton/sao
hostname = sugelicoMach
listen = 0.0.0.0:18462

Thanks in advance

Have you actually setup the PostgreSQL database yet?

“trytond-admin -d tryton --all” is the command to create all the tables once the database has been created.

Cheers,
Sean

If you open the log (in the browser [ctrl+shift+k in firefox]) you can check for a more specific error.

I had the same issue, and it was that the database role/user didn’t have access to the postgres templates (you can check the browser console logs, i think will say that failed to found Template0 or something like that…)

Failed to load resource: the server responded with a status of 405 (METHOD NOT ALLOWED)
custom.css:1 Failed to load resource: the server responded with a status of 405 (METHOD NOT ALLOWED)
tryton-sao.min.js:5 [Deprecation] The Notification API may no longer be used from insecure origins. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
(anonymous) @ tryton-sao.min.js:5
:18462/locale/en_US.json:1 Failed to load resource: the server responded with a status of 405 (METHOD NOT ALLOWED)
:18462/locale/en.json:1 Failed to load resource: the server responded with a status of 405 (METHOD NOT ALLOWED)
custom.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)

This is what I get @wifasoi

Nothing to worry there.
If you did not setup the database, you must follow: How to setup a database — trytond 5.5 documentation
And if you did it, you must ensure that the owner of the database is the same as the user used by trytond to connect to the database.

It’s the same. I’d already follow the setup of the database.

Screenshot from 2020-03-04 14-55-46

This is the error that comes in the desktop version, althought allow me to work, give me this problem, I just bring it to see if is related.

Then check the server logs in verbose mode.

2540 140092390315776 [2020-03-04 20:39:37,072] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:39:37] "POST /sug_tryton/ HTTP/1.1" 200 -
2540 140092390315776 [2020-03-04 20:39:37,249] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:39:37] "POST / HTTP/1.1" 200 -
2540 140092381923072 [2020-03-04 20:39:37,382] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:39:37] "POST /sug_tryton/ HTTP/1.1" 200 -
2540 140092381923072 [2020-03-04 20:39:37,567] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:39:37] "POST / HTTP/1.1" 200 -
2540 140092381923072 [2020-03-04 20:39:37,708] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:39:37] "POST /sug_tryton/ HTTP/1.1" 200 -
2540 140092381923072 [2020-03-04 20:39:37,878] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:39:37] "POST /sug_tryton/ HTTP/1.1" 200 -
2540 140092536309504 [2020-03-04 20:41:27,060] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET / HTTP/1.1" 200 -
2540 140092407625472 [2020-03-04 20:41:27,182] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /custom.js HTTP/1.1" 405 -
2540 140092407625472 [2020-03-04 20:41:27,258] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /custom.css HTTP/1.1" 405 -
2540 140092407625472 [2020-03-04 20:41:27,388] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /custom.js HTTP/1.1" 405 -
2540 140092407625472 [2020-03-04 20:41:27,549] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /custom.css HTTP/1.1" 405 -
2540 140092407625472 [2020-03-04 20:41:27,717] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /locale/en_US.json HTTP/1.1" 405 -
2540 140092407625472 [2020-03-04 20:41:27,737] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /images/tryton-icon.png HTTP/1.1" 200 -
2540 140092407625472 [2020-03-04 20:41:27,891] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:27] "GET /locale/en.json HTTP/1.1" 405 -
2540 140092407625472 [2020-03-04 20:41:28,059] INFO werkzeug x.x.x.x.x - - [04/Mar/2020 20:41:28] "POST / HTTP/1.1" 200 -

It doen’t show anything wrong. I am thinking on make a clean installation of the server.

Then it is typically because it does not find the database. Have not you define a specific hostname with trytond-admin --hostname ?

In the config file, but let me do it in the admin

You must not do it if you do not want it. I’m just trying to understand what exactly you did to no have the database listed. One possibility is to restrict a database to be listed based on hostname. But this is a very advanced usage.

But if I want to expose a sao web to the world, I need to specified? Because my site is listed on a domain. and expose to the world.

The [web] hostname is only for when trytond needs to construct an URL. It has no impact on the listen -only [web] listen.
The trytond-admin --hostname limit database listing to the hostname as the command line help says.
So to listen from the out side, you only need to setup [web] listen to 0.0.0.0.

Now you have to debug trytond to understand why Database.list from trytond/backend/postgresql/database.py does not return your database.

Ok, let me start with that!
Thanks, I’ll keep it post it!

I was checking the error, and the problem is with the server specifically, I own the database but the server always give me the error, I think, one solution could be let the database area open so the user can put it when the system can’t find the database like the desktop client, another could be check the code, but there’s no error in the code.

What error? Could you please provide the exception and traceback?

Hello, I found the problem, is that the database file use template1 as database to connect and make the check for the tryton databases, as I am not the owner of that database in the server, the system didn’t get any database, but when I’ve changed the name of the database to one that is own by me, the system start to work.

Here is the change to the code

    def __new__(cls, name='sug_tryton'):
    with cls._lock:
        now = datetime.now()
        databases = cls._databases[os.getpid()]
        for database in list(databases.values()):
            if ((now - database._last_use).total_seconds() > _timeout
                    and database.name != name
                    and not database._connpool._used):
                database.close()
        if name in databases:
            inst = databases[name]
        else:
            if name == _maindatabase:
                minconn = 0
            else:
                minconn = _minconn
            inst = DatabaseInterface.__new__(cls, name=name)
            logger.info('connect to "%s"', name)
            inst._connpool = ThreadedConnectionPool(
                minconn, _maxconn, **cls._connection_params(name),
                cursor_factory=LoggingCursor)
            databases[name] = inst
        inst._last_use = datetime.now()
        return inst 

sug_tryton, is my database, but can be change to another database, also I add

_maindatabase

so I can control from outside the database, I want to know more about how this code works, so I can help to improve it for people with hosting like me.

By default template1 is the name of the PostgreSQL database that any user can connect to.
But I agree that we should allow to change this name for non standard setup.

How can I upload a solution, to that code, when I find it?