Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with psycopg2 and AWS Elastic Beanstalk #2

Open
igorkf opened this issue Jun 12, 2021 · 0 comments
Open

Problems with psycopg2 and AWS Elastic Beanstalk #2

igorkf opened this issue Jun 12, 2021 · 0 comments

Comments

@igorkf
Copy link

igorkf commented Jun 12, 2021

In the beginning, everything was fine using only psycopg2-binary in my virtual environment. So I uploaded the code to EB and eveythings goes fine.

When you changed the strategy (start serving static and media files using S3), you needed to install django-storages and change some configurations at settings.py file. Creating static files using this new strategy seems to require psycopg2.extensions which is not available through the binary package (psycopg2-binary). To try to override this problem, I installed psycopg2 in my virtual environment and I could made the static files, but other problem arised: Elastic Beanstalk was not able to install psycopg2.

I came to a solution using this answer: https://stackoverflow.com/a/63204453/11122513

He added a file 01_packages.config inside .ebextensions with this content:

packages:
    yum:
        amazon-linux-extras: []

commands:
    01_postgres_activate:
        command: sudo amazon-linux-extras enable postgresql10
    02_postgres_install:
        command: sudo yum install -y postgresql-devel

Using this solution, EB was able to install psycopg2 and my app worked well again.
You course was really good, but I think the deployment section was a bit tricky and I had to spend some time to be able to do the deploy.

Thanks,
Igor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant