dimanche 18 mai 2014

Django - configurer élastique haricot magique pour utiliser la nouvelle version de python - Stack Overflow


How can I tell Amazon Elastic Beanstalk to use Python 2.7.3 when running Django without creating a custom AMI?


It seems like it should be straightforward to tell elastic beanstalk to use a later version of python than 2.6. I would really like to not create a custom AMI, as that seems like over-complicating the issue.


I need python 2.7.3, and I need to use virtualenv 1.8.X. I've noticed that using a later version of virtualenv than the amazon deployment tutorial(1.7.X) seems to negatively affect 'git aws.push', but I don't have an option in this case due to client requirements.


I've looked into creating custom container commands in the .ebextensions/*.config, such as:


container_commands:
update_python:
command: "sudo yum -y install python27; sudo ln -sf `which python2.7` /usr/bin/python"

but this breaks yum, which might be ok, but I'd prefer to keep the system intact.


I could install python27 with yum, as demonstrated above, and keep python26 as the default python, but I don't know how to make sure that the server uses python27 to launch Django. So an alternate question would be, how do I tell elastic beanstalk to use python27 to run Django instead of the default python? I can easily get python27 installed on the system as an alternate python, I just have to call it explicitly.


I hope this question isn't too broad. I'm trying to come up with multiple angles to solve this problem. Thanks for any help.




I ran into this exact same problem and the solution was quite simple.


Assuming that your PATH environment variable points to this folder:


<path to unzipped EB CLI package>/eb/linux/python2.7/

Go there and edit the file named "eb"


$cd <path to unzipped EB CLI package>/eb/linux/python2.7/
$vim eb

On the first line where it says "!#/usr/bin/env python" change it to "!#/usr/bin/env python2.7"


And then you should be alright!



How can I tell Amazon Elastic Beanstalk to use Python 2.7.3 when running Django without creating a custom AMI?


It seems like it should be straightforward to tell elastic beanstalk to use a later version of python than 2.6. I would really like to not create a custom AMI, as that seems like over-complicating the issue.


I need python 2.7.3, and I need to use virtualenv 1.8.X. I've noticed that using a later version of virtualenv than the amazon deployment tutorial(1.7.X) seems to negatively affect 'git aws.push', but I don't have an option in this case due to client requirements.


I've looked into creating custom container commands in the .ebextensions/*.config, such as:


container_commands:
update_python:
command: "sudo yum -y install python27; sudo ln -sf `which python2.7` /usr/bin/python"

but this breaks yum, which might be ok, but I'd prefer to keep the system intact.


I could install python27 with yum, as demonstrated above, and keep python26 as the default python, but I don't know how to make sure that the server uses python27 to launch Django. So an alternate question would be, how do I tell elastic beanstalk to use python27 to run Django instead of the default python? I can easily get python27 installed on the system as an alternate python, I just have to call it explicitly.


I hope this question isn't too broad. I'm trying to come up with multiple angles to solve this problem. Thanks for any help.



I ran into this exact same problem and the solution was quite simple.


Assuming that your PATH environment variable points to this folder:


<path to unzipped EB CLI package>/eb/linux/python2.7/

Go there and edit the file named "eb"


$cd <path to unzipped EB CLI package>/eb/linux/python2.7/
$vim eb

On the first line where it says "!#/usr/bin/env python" change it to "!#/usr/bin/env python2.7"


And then you should be alright!


0 commentaires:

Enregistrer un commentaire