Hi Douglas,
Just incase your were not aware, and to help clarify, there are two set_...
methods in proteus.config
:
-
set_trytond
: Used to connect to a localtrytond
server. -
set_xmlrpc
: Used to connect to a remotetrytond
server.
So, to use the set_trytond
method you need to be running the script inside the docker container (with the environment setup correctly, which is done by the entrypoint.sh
script), so you will need to do something like this:
$ sudo docker-compose exec tryton /entrypoint.sh python3
You can then run your script (you need to replace <database_name>
with the name of your database, which will be tryton
based on your docker-compose.yaml
file):
from proteus import config
from os import getenv
config.set_trytond(getenv('TRYTOND_DATABASE_URI') + '<database_name>')
In version 5.8+ this change means in the future you will be able to do just this instead:
from proteus import config
config.set_trytond('<database_name>')
Alternatively you can use the set_xmlrpc
method to connect to your Tryton server from outside your container by doing something like this:
$ pip install proteus
$ python3
Then use set_xmlrpc
to connect to your server (replacing the parts in <>
as appropriate, you may need to quote / encode any special characters in your password):
from proteus import config
config.set_xmlrpc('https://<username>:<password>@<server>:<port>/<database_name>/')