I deployed my project that's using python/django with elastic beanstalk. my question is, how do I do commands like python manage.py rebuild_index in elastic beanstalk? for instance I need to do python manage.py check_permissions before I get a third app, django-userena running. I tried running the command then git commit then eb deploy. But this does not work. Can someone please tell me how I can do such command so in production, things work too
1 Answers
Elastic Beanstalk offers several ways to run custom commands during your deploy. See the "Container Commands" section here for more details: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
However, note the following section of the documentation:
They run after the application and web server have been set up and the application version file has been extracted, but before the application version is deployed.
If you need your command to run after your application has been deployed, you'll need to use a post-deploy hook. Unfortunately there is no customization option for post-deploy scripts, but it's pretty straightforward using the approach outlined here: https://forums.aws.amazon.com/thread.jspa?messageID=493887