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".
CodePudding user response:
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 your requirements.txt
file. You can do that either manually, or with the command pip freeze
.
If you're using docker the command is
docker exec <container_name> pip freeze > requirements.txt
Otherwise if you are inside the runtime environment (Azure VM or docker container) just pip freeze > requirements.txt
will do.
CodePudding user response:
You get the could not locate the package
error when trying to install your package because apt-get update
wasn't successful: invalid operation update
. I'm not familiar with azure web app service but the problem might come from either:
- You running
*apt* update
and then*apt-get* install
which should be fixed by usingapt
orapt-get
for both commands. - Azure preventing you from running
apt update
- An issue with apt. Maybe check that the user running startup.sh has the right permissions ?