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

huangapple go评论78阅读模式
英文:

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

问题

我构建了一个简单的Django应用程序,并尝试使用Azure应用服务和GitHub Actions CI/CD进行部署。在部署过程中,我遇到了错误-
GitHub Action Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' while deploying on Azure App Service
这是我的项目目录结构-
GitHub Action Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' while deploying on Azure App Service
请有人帮助我理解问题出在哪里?我看到了这个答案,但对我不起作用- https://stackoverflow.com/questions/74067023/github-for-django-on-azure-could-not-open-requirements-file-errno-2-no-such

英文:

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-
GitHub Action Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' while deploying on Azure App Service
Here is my project directory structure-
GitHub Action Error: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt' while deploying on Azure App Service
Can somebody please help me understand what the issue is here? I came accross this answer but this is not working for me- https://stackoverflow.com/questions/74067023/github-for-django-on-azure-could-not-open-requirements-file-errno-2-no-such

答案1

得分: 1

  • 如@Azeem和@aknosis所提到的,文件名应该是requirements.txt,但你的文件名是requirement.txt。因为你正在使用的命令是pip install requirements.txt

  • 如果你仍然遇到错误,请检查Library_Management_System文件夹中是否仍然有requirements.txt文件,如果存在则删除该文件。

当我尝试部署我的Django应用程序时,我也遇到了相同的错误。

根据我的观察,我在mysite项目文件夹中有一个requirements.txt文件,而不是在应用程序的根目录中。因此,我无法将我的应用程序部署到Azure。

项目结构:

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

GitHub:

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

后来,我将requirements.txt文件从mysite 项目 文件夹中移除,并将其移到了存储库的根目录

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

部署:

我成功将Django应用程序部署到Azure App Service,如下所示:

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

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

英文:
  • 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:

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

GitHub:

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

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

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

Deployment:

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

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

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

huangapple
  • 本文由 发表于 2023年7月14日 03:03:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76682513.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定