0

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?

JacobF
  • 2,305
  • 3
  • 24
  • 36
  • 1
    Just to double check: are you sure your command is part of your container_commands directive? Also, not sure if that matters, but you could use `python manage.py syncdb --noinput` instead of django-admin.py and see if that makes a difference. – yellowcap Mar 20 '14 at 17:24
  • @yellowcap: Strangely, `python manage.py syncdb` works. I still don't understand why `django-admin.py` gives an error while it worked before, and is mentioned in the official EB manual. Anyway, thanks for the suggestion! – JacobF Mar 21 '14 at 09:04
  • Glad that this worked, I am also not sure what exaclty the problem is in that case, but manage.py adds the project's directory to the path and a few other things, so that probably makes the difference, see https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-py-and-manage-py – yellowcap Mar 21 '14 at 09:20
  • Which Elastic Beanstalk solution stack are you using? – Rohit Banga Mar 21 '14 at 19:43
  • @RohitBanga I'm not sure how I can see this, but at the time I believe it was a 64bit Python 2.7 Linux stack. – JacobF Mar 24 '14 at 17:27
  • see this post: http://stackoverflow.com/questions/17137346/psycopg2-on-amazon-elastic-beanstalk/23922927 – quin May 30 '14 at 00:33

0 Answers0