6

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]
------------------------------------------------------------

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

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

My config file in .ebextension content is:

    container_commands:   
        01_sh_executable:
            command: "chmod +x .platform/hooks/predeploy/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

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.

Any help will be highly appreciated.

1 Answers1

13

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

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

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

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

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

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.

I hope this will help users on windows!

Ravikumar Sharma
  • 3,678
  • 5
  • 36
  • 59