All of my Python projects used a app server that will bind to 127.0.0.1:__PORT__
In my GitHub - YunoHost-Apps/pyinventory_ynh: YunoHost app package for: https://github.com/jedie/PyInventory project it currently looks like this:
So only the “install” used a “free” port. All other remains to the same port.
Currently the “restore” script doesn’t contain anything about the port
… So i assume the last used port in the backup remains, isn’t it?
now i have a clash: A other application used already port 8000… And i restored a backup of my PyInventory project. Restore was successfully, but the assigned domain was response from the “wrong” application: The already installed one…
Question: Maybe it’s a better idea to always use the port=$(ynh_find_port --port=8000)
pattern to get a free port in all scripts (install/change_url/upgrade/restore) …
Because the finally used port is not important. The main thing is, that it’s exclusive used by the correct app. So better save than sorry and always find a free port?