我正试图将我的django应用程序部署到AWS beanstall,我得到了以下错误
2022/03/05 08:06:43.401505 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_sourc
e_bundle -d /var/app/staging/
2022/03/05 08:06:45.020761 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging
/ successfully
2022/03/05 08:06:45.024804 [ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop run
ning the command. Error: chown /var/app/staging/env/bin/python: no such file or directory
2022/03/05 08:06:45.024814 [INFO] Executing cleanup logic
2022/03/05 08:06:45.024928 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAI
LURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For de
tails, see 'eb-engine.log'.","timestamp":1646467605,"severity":"ERROR"}]}]}
我的配置文件如下
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: "src.settings"
PYTHONPATH: "/var/app/current:$PYTHONPATH"
aws:elasticbeanstalk:container:python:
WSGIPath: "src.wsgi:application"
有人能告诉我我可能做错了什么吗?请注意,我目前没有通过django设置在外部文件中使用任何环境变量
我猜您在源捆绑包中部署了名为env
的虚拟环境,导致了冲突。您应该使用一个.ebignore
(如果使用Git,则为.gitignore
(文件,该文件包含env/
的条目,以排除您的虚拟环境目录。
有关使用.ebignore
和.gitignore
的更多信息,请参阅https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html#python-烧瓶展开和https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-configuration.html#eb-cli3 ebignore。