I followed the Docs of trytond and want to set the database of trytond the existing mysql database, but it never succeeded.
This is the another question I thought similar but not the same on stack overflow. I got error when I execute this command
trytond -c <config_file> -d <database name> --all
I'm not sure whether the problem has relation with installing process, so the following list my installation step:
1. From the main page of tryton
2. Execute $ pip install trytond
That's all.
I added a session
[database]
uri = mysql://user:pass@localhost:3306/
And changed the default database from
self.set('database', 'uri',
os.environ.get('TRYTOND_DATABASE_URI', 'sqlite://'))
to
self.set('database', 'uri',
os.environ.get('TRYTOND_DATABASE_URI', 'mysql://user:pass@localhost:3306/'))
These lines of code are used to config the database as my understanding.
This was the result when executing.
Traceback (most recent call last):
File "/Users/chenxiangjun/anaconda3/envs/env/bin/trytond-admin", line 13, in <module>
from trytond.config import config
File "/Users/chenxiangjun/anaconda3/envs/env/lib/python3.6/site-packages/trytond/config.py", line 14
uri = mysql://user:pass@localhost:3306/
^
SyntaxError: invalid syntax
I changed the error line from
[database]
uri = mysql://user:pass@localhost:3306/
to
[database]
uri = 'mysql://user:pass@localhost:3306/'
I got this error
Traceback (most recent call last):
File "/Users/chenxiangjun/anaconda3/envs/env/bin/trytond-admin", line 13, in <module>
from trytond.config import config
File "/Users/chenxiangjun/anaconda3/envs/env/lib/python3.6/site-packages/trytond/config.py", line 13, in <module>
[database]
NameError: name 'database' is not defined
Is anyone know how to solve this problem or has the same experience? This is the first time I setup an ERP.
The error is because you included some syntax error when modifying the python source file. You should not modify this file but set the value on your configuration file.
The configuration file is not created by default so you should create one manually. This is a text file and can be placed anywhere on your computer, just ensure that the user running trytond has enought rights to read it.
Here is a sample one for your configuration:
[database]
uri = mysql://user:pass@localhost:3306/
Once you've create this file you should execute the server with:
trytond -c
BTW: MYSQL backend is not supported since version 4.8, so if you are using a newer version you should consider using sqlite or Postgresql.