/.platform/hooks/': 将 Django 应用程序部署到 AWS Elastic Beanstalk 时没有这样的文件或目录 [英] /.platform/hooks/': No such file or directory when deploying Django App to AWS Elastic Beanstalk

查看:45
本文介绍了/.platform/hooks/': 将 Django 应用程序部署到 AWS Elastic Beanstalk 时没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Django 应用程序部署到 AWS ElasticBeanStalk.

I am trying to deploy a Django app to AWS ElasticBeanStalk.

我按照标记正确答案中的所有指南进行操作,但仍然出现以下错误:

I followed all the guides in the marked correct answer but I still get the below error:

[INFO] -----------------------Command Output-----------------------
[INFO]  find: '/.platform/hooks/': No such file or directory [INFO]
------------------------------------------------------------

当我使用 Windows 操作系统时,我从 https://cocalc.com/ 在线创建了我的 .sh 文件控制台.

As I used windows OS, I created my .sh file from https://cocalc.com/ online console.

我还压缩了文件并使用 EBS 控制台进行部署,以避免我的文件在 git add/commit 期间被转换.

I also zipped the files and used the EBS console to deploy to avoid my files being converted during git add/commit.

我在 .ebextension 中的配置文件是:

My config file in .ebextension content is:

    container_commands:   
        01_sh_executable:
            command: "chmod +x .platform/hooks/predeploy/01_execute.sh"

我的 01_execute.sh 文件内容是:

My 01_execute.sh file content is:

#!/bin/bash

source /var/app/venv/*/bin/activate
cd /var/app/staging

python manage.py makemigrations
python manage.py migrate
python manage.py createsu
python manage.py collectstatic --noinp

选择的平台是在 64 位 Amazon Linux 2 上运行的 Python 3.7.我还注意到,当我运行 eb ssh 并键入 ls 时,它返回空白.Linux 不是我的强项之一.

The platform chosen is Python 3.7 running on 64bit Amazon Linux 2. I also noticed that when I run eb ssh and type ls, it returns blank. Linux is not one of my strength.

任何帮助将不胜感激.

推荐答案

此答案适用于使用 windows 将文件部署到 elastic beanstalk 的用户.

This answer is for users who are using windows to deploy their files to elastic beanstalk.

我在花了 6 个小时的宝贵时间后找到了此信息.可能没有在官方文档中的任何地方记录

I found this information after spending 6 precious hours. Probably not documented anywhere in official documentations

根据此链接https://forums.aws.amazon.com/thread.jspa?threadID=321653"

As per this link "https://forums.aws.amazon.com/thread.jspa?threadID=321653"

psss:最重要的是文件以 LF 行分隔符保存.CRLF 使找不到文件或目录"

psss: most important that the file is saved with LF line separator. CRLF makes "no file or directory found"

所以我使用 Visual Studio Code 将 .platform/hooks/postdeploy

So I used Visual Studio Code to convert CRLF to LF for files in .platform/hooks/postdeploy

在 VS Code 的屏幕右下角有一个小按钮显示LF"或CRLF":单击该按钮并将其更改为您的偏好.

At the bottom right of the screen in VS Code there is a little button that says "LF" or "CRLF": Click that button and change it to your preference.

我希望这会对 Windows 用户有所帮助!

I hope this will help users on windows!

这篇关于/.platform/hooks/': 将 Django 应用程序部署到 AWS Elastic Beanstalk 时没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆