Django on AWS Elastic Beanstalk: Unexpected syncdb

2019-09-01 01:16发布

I have a Django/PostgreSQL application. I use Elastic Beanstalk to deploy it to an Amazon EC2 instance with RDS.

Today, deployment suddenly failed with the following error. Also older code versions are suddenly not able to deploy.

[Instance: i-f8ae27ce Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: Error occurred during build: Command 01_syncdb failed .

It's related to this command in my elastic beanstalk config file:

command: "django-admin.py syncdb --noinput"

Digging in the log files shows that the above command raises this error:

ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2

This is weird, because I have psycopg2 in my requirements.txt, and I can verify that it's installed. Also, I have postgresql-devel installed as yum package via the EB config file.

Does anybody know why my deployment suddenly failed?

0条回答
登录 后发表回答