Search code examples
pythondjangoazure-web-app-servicegithub-actionsrequirements.txt

GitHub Action Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' while deploying on Azure App Service


I built a simple Django application and am trying to deploy it using Azure App Service and GitHub Actions CI/CD. While deploying, I am getting the error- enter image description here Here is my project directory structure- enter image description here Can somebody please help me understand what the issue is here? I came accross this answer but this is not working for me- GitHub for Django on Azure: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'


Solution

    • As @Azeem and @aknosis mentioned, the file name should be requirements.txt but you have requirement.txt. Because the command you are using is pip install requirements.txt.

    • If you still face the error, check if you still have requirements.txt in Library_Management_System folder and delete if the file exists.

    I was getting the same error when I tried to deploy my Django application.

    As per my observation, I had requirements.txt file inside the mysite project folder instead of Root folder of my application. Hence, I was not able to deploy my app to Azure.

    Project Structure:

    enter image description here

    GitHub:

    enter image description here

    Later, I removed requirements.txt file from mysite project folder and moved it to Root folder of the repository.

    enter image description here

    Deployment:

    I could deploy Django application to Azure App Service as shown below:

    enter image description here

    enter image description here