Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure app service cannot find installed modules

I am attempting to deploy a Django app to a Linux server via an Azure App Service. During the deployment via Azure Devops Pipelines, all requirements are installed from my requirements.txt file in the root directory of my project.

I have used the Kudu console to confirm the dependencies are installed to /antenv/lib/python3.7/site-packages on the server, however, the app crashes due to an error:

ModuleNotFoundError: No module named 'django'

I am beginning to think the virtual environment may be failing to actually start but do not know how to check or how to start it if this is the case.

Has anyone had a similar issue to this during their deployment? If so how did you resolve it? Any advise is much appreciated. Thank you!

like image 430
Adam Tamargo Avatar asked Oct 21 '25 04:10

Adam Tamargo


1 Answers

The restore during the build is not sent to the app service.

Is necessary to add the configuration key SCM_DO_BUILD_DURING_DEPLOYMENT with value: 1

enter image description here

It will install requirements during deployment.

If you need any initialization code like in my example, you can add it in General Settings

enter image description here

like image 147
Murilo Maciel Curti Avatar answered Oct 23 '25 21:10

Murilo Maciel Curti