- Newest
- Most votes
- Most comments
Why I really do not know, I run the build code under the pre-run and successfully deploy and run
version: 1.0
runtime: python311
build:
commands:
build:
- python3.11 -m ensurepip --upgrade
- python3.11 -m pip install Django
- python3.11 -m pip install -r requirements.txt
- python3.11 -m pip install gunicorn
env:
- name: DEBUG
value: "on"
- name: SECRET_KEY
value: "*"
- name: ALLOWED_HOSTS
value: "*"
run:
runtime-version: 3.11
pre-run:
- pip3 install gunicorn
- pip3 install -r requirements.txt
- which gunicorn
command: gunicorn app_runne.wsgir:application --log-file -
network:
port: 8000
env: 8000
env:
- name: DEBUG
value: "on"
- name: SECRET_KEY
value: "*"
- name: ALLOWED_HOSTS
value: "*"
Hello, I also faced the same issue but somehow I resolved this issue. I was testing AWS App Runner for my security research work in post compromise scenario. Here's the blog.
- App Runner doesn't natively manage virtual environments like
pipenv
. You need to ensure Django and its dependencies are installed within the build container itself. - Remove the
pipenv
install commands from bothbuild
andpre-run
sections. They're not necessary in this context. - Include a command that installs Django and required dependencies directly using
pip3 install Django
(replace Django with your specific package names) in the build section.
Use the below YAML code once and check if pip
is also upgraded. Hope this helps!
version: 1.0 runtime: python311 build: commands: - python3.11 -m ensurepip --upgrade # Upgrade pip (optional) - pip3 install Django # Install Django and dependencies - python3 manage.py test env: - name: DEBUG value: "on" - name: SECRET_KEY value: ***** - name: ALLOWED_HOSTS value: "*" run: runtime-version: 3.11 command: pip3 install gunicorn django_apprunner.wsgi # Install gunicorn at runtime pre-run: [] # Remove pre-run section command: gunicorn django_apprunner.wsgi --log-file - network: port: 8000 env: 8000 env: - name: DEBUG value: "on" - name: SECRET_KEY value: **** - name: ALLOWED_HOSTS value: "*"
yeah please try this
Install Gunicorn During Build: Ensure Gunicorn is installed during the build phase using pip3 install gunicorn
. This ensures it's available in the container's environment.
Check File Paths and Permissions: Double-check that the path to django_apprunner.wsgi
is correct and that the file has execute permissions.
version: 1.0 runtime: python311 build: commands: - python3.11 -m ensurepip --upgrade - pip3 install Django # Install Django and dependencies - pip3 install gunicorn # Install gunicorn during build - python3 manage.py test env: - name: DEBUG value: "on" - name: SECRET_KEY value: ***** - name: ALLOWED_HOSTS value: "*" run: runtime-version: 3.11 command: gunicorn django_apprunner.wsgi --log-file - network: port: 8000 env: 8000 env: - name: DEBUG value: "on" - name: SECRET_KEY value: **** - name: ALLOWED_HOSTS value: "*"
Unfortunately, the same error occurs, and the file PATH is true but I do not understand how can I give permission to this file.
Relevant content
- asked 10 months ago
- asked 5 months ago
- AWS OFFICIALUpdated 13 days ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 4 months ago
Invalid start command. Update the start command you provided during the App Runner service configuration and re-try. - CannotStartContainerError: ResourceInitializationError: failed to create new container runtime task: failed to create shim task: failed to create task: rpc error: code = Unknown desc = OCI runtime create failed: runc create failed: unable to start container process: exec: "gunicorn": executable file not found in $PATH: unknown
After refactoring the yml, this error occurs ? Do you have any other suggestion ?