我需要幫助部署Django的web應用程序AWS EB。我的本地開發環境是mac os特立獨行。我使用的是django 1.6和virtualenv 1.11.4。如果您能夠使用AWS指令進行部署,我真的希望您能分享您的經驗以及您爲克服障礙所做的不同。AWS彈性魔豆,構建過程中出現錯誤:命令01_syncdb
[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.
從本質上講,這些錯誤來自何方配置文件配置錯誤。你能分享一下你的成功故事嗎,或者你是如何在部署中通過這一步的?正如我所看到的,下面的amazon文檔不起作用。順便說一句,我也嘗試了下面的例子,它似乎也不適用於我。 http://grigory.ca/2012/09/getting-started-with-django-on-aws-elastic-beanstalk/
我真的很感謝你的幫助。
謝謝,eb日誌很有幫助。這應該通過官方的django python在benastalk應用程序中更好地記錄。相反,它只是說「查看故障排除」 – radtek
使用AWS「查看故障排除」的含義是:將其轉到Google,然後閱讀StackExchange。 ;) –
有時雖然錯誤非常糟糕,但eb日誌不會返回任何內容,並且從控制檯下載日誌也不會。服務器也不返回任何答覆。當我轉換到一個支持geodjango開箱的較舊實例時,我有了這個。發生這種情況時,您必須手動ssh進入EC2實例來檢查日誌。 – radtek