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
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)
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.
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.
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.
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.
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.