Hello everyone
Is it possible to have a flask application that needs to communicate with tryton and that is located outside the virtual machine where tryton is installed?
I’ve tried to configure it properly but I’m aiming at this level.
Here is the error and the configuration.
- Configuration
# create and configure the app
app = Flask(__name__)
app.config.from_object(__name__+'.ConfigClass')
app.config['TRYTON_CONFIG'] = 'http://172.17.0.7:2050/home/gnuhealth/gnuhealth/tryton/server/config/trytond.conf'
#app.config['TRYTON_CONFIG'] = '/home/gnuhealth/gnuhealth/tryton/server/config/trytond.conf'
app.config['TRYTON_DATABASE'] = 'postgresql://gnuhealth:toor@172.17.0.7:2051/PDMD_SANTE'
#app.config['TRYTON_DATABASE'] = 'pdmd_sante'
app.config['TRYTON_USER'] = 0
app.config['CORS_HEADERS'] = 'Content-Type'
db = SQLAlchemy(app)
CORS(app, resources={r"*": {"origins": "*"}})
print("L'application app ----------------- ", app.config)
- Error when i start the flask application
WARNING: Flask-User TokenManager: SECRET_KEY is shorter than 32 bytes.
could not load http://172.17.0.7:2050/home/gnuhealth/gnuhealth/tryton/server/config/trytond.conf
Traceback (most recent call last):
File "/home/gnuhealth/Flask/flaskvenv/bin/flask", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask/cli.py", line 1054, in main
cli.main()
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask/cli.py", line 918, in run_command
raise e from None
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask/cli.py", line 904, in run_command
app = info.load_app()
^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask/cli.py", line 308, in load_app
app = locate_app(import_name, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask/cli.py", line 218, in locate_app
__import__(module_name)
File "/home/gnuhealth/Flask/DoctorAPI/__init__.py", line 106, in <module>
tryton = Tryton(app)
^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask_tryton.py", line 25, in __init__
self.init_app(app)
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/flask_tryton.py", line 42, in init_app
with Transaction().start(database, user, readonly=True):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/trytond/transaction.py", line 218, in start
self.stop(False)
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/trytond/transaction.py", line 237, in stop
self.rollback()
File "/home/gnuhealth/Flask/flaskvenv/lib/python3.12/site-packages/trytond/transaction.py", line 355, in rollback
for datamanager in self._datamanagers:
^^^^^^^^^^^^^^^^^^
AttributeError: 'Transaction' object has no attribute '_datamanagers'
Please someone can healp me?