Django/Python Package installed via SSH gets removed when azure app restarts

Joe 1 Reputation point

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 script on the wwwroot path but when run it shows error that "could not locate the package".

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,068 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 14,216 Reputation points Microsoft Employee

    @Joe Thank you for reaching out to Microsoft Q&A, apologize for the inconvenience caused any on this.

    For Python on App Service Linux you should not use methods like FTP or ZipDeploy (without the use of Oryx) to avoid improper deployment since the Python environment will not be built, thus causing errors like ModuleNotFound or others - since pip install is not ran in these scenarios as mentioned in this documentation here.

    If you want to add the missing Package through the custom start script you need to create script file (.sh) under /home directory and add the path of script file (/home/ to start up command(In general settings under configuration in the portal) to keep your package persistent even after the restart as well. Here is the reference document on configuring customer start script in python apps.

    I would suggest you follow this documentation steps to deploy Django Deployment on App service.

    Feel Free to reach back to me if you have any questions on this.