Hello.
I have given a test.svg as a default image for the binary field.
The picture gets displayed in my localhost but when I push the code to the server, it throws an error saying the “test.svg” file not found.
How do I rectify this?
Probably that the test.svg
file is not installed by your deployment. Is it define as package_data
in your setup.py
?
Yes, it is defined in my setup.py as package_data.
Are you opening it using the trytond.tools.file_open
function?
This method should be used because setuptools may put the file in different places depending on your setup, OS etc.
I found out that there are no files or folders related to my module in my trytond/modules directory
The images are in this folder
But I can’t open from here because of the secure_join function of file_open and the root that file_open takes is location of python virtual environment/lib/python3.6/site-packages/trytond-5.0.6-py3.6.egg/trytond
Please help
The files used by a module must be installed inside this module. So I suspect that the package_date
is not correctly setup such that the installation put them in the module.
The location seems a bit weird to me.
Shouldn’t this be python virtual environment /lib/python3.6/site-packages/trytond ? This is where all my tryton data lives is.
I finally solved this problem
The path to be given is module_name/path_to_test.svg_relative_to_module_name