I have uploaded Django app on azure server web app using Zip Deploy with FTP. After deploying it gives error that "sndlibrary not found" so i need to go to ssh and install it manually by using command apt update && apt-get -y install libsndfile1-dev
.So The problem is that whenever the app(container) gets restarted it again shows the same error and i again need to install the package from ssh.The package does not persist on restart.So is there any way to persist the package on app restart?
I have also tried using startup.sh script on the wwwroot path but when run it shows error that "could not locate the package".
2
Answers
Every time you restart the container, if the image is rebuilt, the packages are installed from your
requirements.txt
file. What you have to do is simply adding it to yourrequirements.txt
file. You can do that either manually, or with the commandpip freeze
.If you’re using docker the command is
Otherwise if you are inside the runtime environment (Azure VM or docker container) just
pip freeze > requirements.txt
will do.You get the
could not locate the package
error when trying to install your package becauseapt-get update
wasn’t successful:invalid operation update
. I’m not familiar with azure web app service but the problem might come from either:*apt* update
and then*apt-get* install
which should be fixed by usingapt
orapt-get
for both commands.apt update