简体   繁体   English

使用Elastic Beanstalk进行部署

[英]Deploying With Elastic Beanstalk

I've been attempting to deploy using elastic beanstalk, but I've had no luck. 我一直在尝试使用弹性beantalk进行部署,但是我没有运气。 Every time I get the error 每次我得到错误

Command failed on instance. Return code: 1 Output: Error occurred during build: Command     01_syncdb failed

Here's my workstudy.config file inside .ebextenstions directory 这是我的.ebextenstions目录中的workstudy.config文件

container_commands:
   01_syncdb:    
     command: "manage.py syncdb --noinput"
     leader_only: true

 option_settings:
   - namespace: aws:elasticbeanstalk:container:python
     option_name: WSGIPath
     value: workstudy/wsgi.py
   - option_name: DJANGO_SETTINGS_MODULE
     value: workstudy.settings
   - option_name: AWS_SECRET_KEY
     value: ************
   - option_name: AWS_ACCESS_KEY_ID
     value: ***********

Here's my database settings 这是我的数据库设置

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.environ['RDS_DB_NAME'],
        'USER': os.environ['RDS_USERNAME'],
        'PASSWORD': os.environ['RDS_PASSWORD'],
        'HOST': os.environ['RDS_HOSTNAME'],
        'PORT': os.environ['RDS_PORT'],
    }
}

Here's my requirements.txt file 这是我的requirements.txt文件

Django==1.6.5
MySQL-python==1.2.5
South==1.0
boto==2.30.0
django-debug-toolbar==1.2.1
sqlparse==0.1.11
wsgiref==0.1.2

I also tried changing the command to django-admin.py but that didn't work either. 我也尝试将命令更改为django-admin.py,但这也不起作用。 Any help would be great thanks 任何帮助将不胜感激

You should source virtualenv scope, before running any app related code and manage.py is part of your application: 在运行任何与应用程序相关的代码之前,您应该获取virtualenv范围的源,并且manage.py是应用程序的一部分:

  01_syncdb:    
    command: "source /opt/python/run/venv/bin/activate && python manage.py syncdb --noinput"
    leader_only: true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM