Hello,
Question from a newbie
Context : Windows 10 Home / WSL 2 / Ubuntu 20.04 ; tryton:latest installed successfully using the docker procedure ; tryton is now « localhost :8000 » accessible
Executing in my « home » directory :
Command : TRYTOND_DATABASE_URI=‘postgresql://tryton:5432/tryton’ trytond_import_countries -d ‘postgresql://tryton:5432/tryton’
Response : trytond_import_countries.py: command not found
Command : docker run --rm -ti tryton/tryton --pyrun trytond_import_countries.py
Response : open(“trytond_import_countries.py”): No such file or directory [plugins/python/python_plugin.c line 1795]
Both Run #1 & #2 give no result in browser after refresh
Run #1:
docker run --rm -ti tryton/tryton --pyrun trytond_import_countries -d ‘postgresql://tryton:5432/tryton’
[uWSGI] getting INI configuration from /etc/uwsgi.conf
Run #2
postgres@LAPTOP-U8FF0ITJ:~$ docker run --rm -ti tryton/tryton --pyrun trytond_import_countries
[uWSGI] getting INI configuration from /etc/uwsgi.conf
Run #3 (adding “-c trytond.conf”) : error message
docker run --rm -ti tryton/tryton --pyrun trytond_import_countries -d ‘postgresql://tryton:5432/tryton’ -c trytond.conf
[uWSGI] getting INI configuration from /etc/uwsgi.conf
unable to load configuration from trytond.conf
Run #4 (adding reference to DB) : error message
docker run --rm -ti tryton/tryton --pyrun TRYTOND_DATABASE_URI=‘postgresql://tryton:5432/tryton’ trytond_import_countries -d ‘postgresql://tryton:5432/tryton’
[uWSGI] getting INI configuration from /etc/uwsgi.conf
unable to load configuration from trytond_import_countries
I do not know what is this --pyrun option. It is not a standard docker option.
Also the value of the --database option should be the database name only.
So you should run:
$ docker run --rm -ti tryton/tryton trytond_import_countries -d tryton
supposing that volumes and network are correctly configured.
I get could not translate host name “postgres”: name or servce not known when following that last reply.
I have the same issue as the OP.
I followed the docker instructions exactly, same db, same container etc
Thanks for pointing that out ! So to be complete :
my commands were indeed run towards “existing started” tryton container
Also worked as per your suggestion : docker exec --interactive --tty tryton /entrypoint.sh trytond_import_countries -d tryton docker exec --interactive --tty tryton /entrypoint.sh trytond_import_currencies -d tryton
docker version 20.10.2
suggestion from a newbie : best to run the above commands (in whatever format) after installing Tryton and before using other functions (companies, sales, etc.)
Thanks, I don’t know much about Docker at all and the Tryton Docker guide doesn’t go into detail about how to run commands that are documented in the regular documentation.
Knowing it needs to be docker exec --… is going to be a great help.
Can somebody help please ?
I could successfully update currencies but not countries.
Here is the message :
PS C:\WINDOWS\system32> docker exec --interactive --tty tryton /entrypoint.sh trytond_import_countries -d tryton
/usr/lib/python3/dist-packages/zeep/loader.py:5: DeprecationWarning: defusedxml.lxml is no longer supported and will be removed in a future release.
from defusedxml.lxml import fromstring
Traceback (most recent call last):
File "/usr/local/bin/trytond_import_countries", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.9/dist-packages/trytond/modules/country/scripts/import_countries.py", line 563, in run
main(args.database, args.config_file)
File "/usr/local/lib/python3.9/dist-packages/trytond/modules/country/scripts/import_countries.py", line 541, in main
do_import()
File "/usr/local/lib/python3.9/dist-packages/trytond/modules/country/scripts/import_countries.py", line 545, in do_import
countries = get_countries()
File "/usr/local/lib/python3.9/dist-packages/trytond/modules/country/scripts/import_countries.py", line 390, in get_countries
Country = Model.get('country.country')
File "/usr/local/lib/python3.9/dist-packages/proteus/__init__.py", line 768, in get
class Spam(Model, metaclass=MetaModelFactory(name, config=config)()):
File "/usr/local/lib/python3.9/dist-packages/proteus/__init__.py", line 488, in __new__
proxy = self.config.get_proxy(self.model_name)
File "/usr/local/lib/python3.9/dist-packages/proteus/config.py", line 299, in get_proxy
return TrytondProxy(name, self, type=type)
File "/usr/local/lib/python3.9/dist-packages/proteus/config.py", line 225, in __init__
self._object = config.pool.get(name, type=type)
File "/usr/local/lib/python3.9/dist-packages/trytond/pool.py", line 188, in get
return self._pool[self.database_name][type][name]
KeyError: 'country.country'