简体   繁体   中英

Deploying With Elastic Beanstalk

I've been attempting to deploy using elastic beanstalk, but I've had no luck. 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

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

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. 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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