英文:
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进行部署。在部署过程中,我遇到了错误-
这是我的项目目录结构-
请有人帮助我理解问题出在哪里?我看到了这个答案,但对我不起作用- 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-
Here is my project directory structure-
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:
后来,我将requirements.txt
文件从mysite
项目 文件夹中移除,并将其移到了存储库的根目录。
部署:
我成功将Django应用程序部署到Azure App Service,如下所示:
英文:
-
As @Azeem and @aknosis mentioned, the file name should be
requirements.txt
but you haverequirement.txt
. Because the command you are using ispip install requirements.txt
. -
If you still face the error, check if you still have
requirements.txt
inLibrary_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:
Later, I removed requirements.txt
file from mysite
project folder and moved it to Root folder of the repository.
Deployment:
I could deploy Django application to Azure App Service as shown below:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论