this is happens when i upload config.json:
sudo curl -X PUT --data-binary @config.json --unix-socket /var/run/control.unit.sock http://localhost/config
{
"error": "Invalid configuration.",
"detail": "The module to run \"python 3.6\" is not found among the available application modules."
}
i tried: Python
, Python 3.7
my config.json that i trying to upload:
{
"listeners": {
"*:1234": {
"pass": "applications/flask"
}
},
"applications": {
"flask": {
"type": "python 3.6",
"processes": 5,
"path": "/home/123/123/",
"home": "/home/123/123/venv/",
"module": "wsgi",
"user": "root",
"group": "root"
}
}
}
This is all happens when i trying to make simple flask-demo with nginx unit
First, you should check if the python module is properly installed. In order to discover where they are located, you can use the unitd --help
as it shows the default options.
$ unitd --help
...
--modules DIRECTORY set modules directory name
default: "/usr/lib/unit/modules"
If you use a custom systemd unit or script, you should check the option --modules
Simply list the files in the modules directory:
$ ls /usr/lib/unit/modules
python3.6.unit.so python3.7.unit.so
If they are there, check in the beginning of the unit.log if they were correctly loaded:
$ sudo more /var/log/unit.log
2020/04/29 22:24:47 [info] 13025#13025 discovery started
2020/04/29 22:24:47 [notice] 13025#13025 module: python 3.6.9 "/usr/lib/unit/modules/python3.6.unit.so"
2020/04/29 22:24:47 [notice] 13025#13025 module: python 3.7.5 "/usr/lib/unit/modules/python3.7.unit.so"
2020/04/29 22:24:47 [notice] 13024#13024 process 13025 exited with code 0
2020/04/29 22:24:47 [info] 13027#13027 router started
2020/04/29 22:24:47 [info] 13026#13026 controller started
2020/04/29 22:24:47 [info] 13027#13027 OpenSSL 1.1.1 11 Sep 2018, 1010100f
If they were not loaded, the log will say the reason.
Unit module versions must match the Unit version installed. If you installed a newer version in a system running the old version, you should reinstall the unit modules as well (apt install unit-dev unit-python3.6 unit-python3.7
).