我需要帮助将 django Web 应用程序部署到 AWS EB。我的本地开发环境是 mac os maverick。我正在使用 django 1.6 和 virtualenv 1.11.4。如果您能够使用 AWS 说明进行部署,我真的希望您能分享您的经验以及您为克服障碍而采取的不同做法。
[django aws] ( http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html )
我被困在第 6 步:更新应用程序。
我已经尝试了几个配置文件,但这些都不起作用:
dgeneric.config:
container_commands:
01_syncdb:
command: "django-admin.py syncdb --noinput"
leader_only: true
option_settings:
- namespace: aws:elasticbeanstalk:container:python
option_name: WSGIPath
value: django_generic/wsgi.py
- option_name: DJANGO_SETTINGS_MODULE
value: django_generic.settings
- option_name: AWS_SECRET_KEY
value: SAMPLESECRETxMkk7DTME37PgiEnzA8toans
- option_name: AWS_ACCESS_KEY_ID
value: SAMPLEACCESSDAHRD7A
dgeneric.config 版本 2:
container_commands:
collectstatic:
command: "django-admin.py collectstatic --noinput"
01syncdb:
command: "django-admin.py syncdb --noinput"
leader_only: true
02migrate:
command: "django-admin.py migrate"
leader_only: true
99customize:
command: "scripts/customize.sh"
You can specify any key-value pairs in the aws:elasticbeanstalk:application:environment namespace and it will be
passed in as environment variables on your EC2 instances
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "django_generic.settings"
"application_stage": "staging"
"aws:elasticbeanstalk:container:python":
WSGIPath: django_generic/wsgi.py
NumProcesses: 3
NumThreads: 20
"aws:elasticbeanstalk:container:python:staticfiles":
"/static/": "static/"
dgeneric.config 版本 3:
container_commands:
00_make_executable:
command: "chmod +x scripts/createadmin.py"
leader_only: true
01_syncdb:
command: "django-admin.py syncdb --noinput"
leader_only: true
02_createadmin:
command: "scripts/createadmin.py"
leader_only: true
03_collectstatic:
command: "django-admin.py collectstatic --noinput"
option_settings:
"aws:elasticbeanstalk:container:python:environment":
DJANGO_SETTINGS_MODULE: "django_generic.settings"
"aws:elasticbeanstalk:container:python":
WSGIPath: "django_generic/wsgi.py"
"aws:elasticbeanstalk:container:python:staticfiles":
"/static/": "static/"
我收到的错误是:
2014-03-19 16:30:09 UTC-0400 INFO Environment update completed successfully.
2014-03-19 16:30:09 UTC-0400 INFO New application version was deployed to running EC2 instances.
2014-03-19 16:30:08 UTC-0400 INFO Command execution completed. Summary: [Successful: 0, Failed: 1].
2014-03-19 16:30:08 UTC-0400 ERROR [Instance: i-3311f412 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command 02_createadmin failed .
2014-03-19 16:28:59 UTC-0400 INFO Deploying new version to instance(s).
这是另一个尝试的错误片段,只对配置文件进行了微小的更改:
2014-03-19 16:02:57 UTC-0400 INFO Environment update completed successfully.
2014-03-19 16:02:57 UTC-0400 INFO New application version was deployed to running EC2 instances.
2014-03-19 16:02:56 UTC-0400 INFO Command execution completed. Summary: [Successful: 0, Failed: 1].
2014-03-19 16:02:56 UTC-0400 ERROR [Instance: i-3311f412 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command 01_syncdb failed .
2014-03-19 16:02:49 UTC-0400 INFO Deploying new version to instance(s).
2014-03-19 16:01:52 UTC-0400 INFO Environment update is starting.
本质上,这些错误来自配置文件的错误配置。您能否分享您的成功故事或您是如何在部署中通过此步骤的?正如我所看到的,遵循亚马逊文档不起作用。顺便说一句,我也尝试了以下示例,但它似乎也不适合我。 http://grigory.ca/2012/09/getting-started-with-django-on-aws-elastic-beanstalk/
我真的很感谢你的帮助。