-
Notifications
You must be signed in to change notification settings - Fork 425
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
psycopg-binary is not recommended for production #3
Comments
Hi @jaromey, I have tested this example with the following libraries in the requirements.txt: Django==2.1.2 And I was able to deploy it to Azure Web App Linux with Python 3.7, as this image depends in Oryx image, the dependency (libpq-dev) for installing psycopg2 is listed there: https://github.com/microsoft/Oryx/blob/master/images/runtime/python/install-dependencies.sh#L16 |
Thanks for your response @edisga. I was never able to got psycopg2 to install in Azure Web App for Linux with Python 3.7. The workaround that I did was to use wheels to pre-compile psycopg. So in our build process we had the following:
Contents of vendor-requirements.txt: Then in our regular requirements.txt file we had the following:
However, you said that it worked for you so I am wondering if I am missing something. Is there some configuration that I needed to do? |
I'm also experiencing the same issue. I just fired up a fresh B1 instance and can cannot get psycopg2 installed, only psycopg2-binary. When trying to install psycopg2, it says
|
Removed the reference so that only Django is in requirements.txt. Thanks. |
Reopening because of changes to requirements.txt, which leaves this issue unresolved. |
We are having the same issue while installing |
We're working to get gcc installed in the host container, which would allow psycopg2 to install automatically as a django dependency. Thanks for your feedback, as it should help prioritize that update. |
I found a compiled version of psycopg2 Hope it helps someone who is still looking into it. |
This repo is referenced in the Microsoft Azure doc, "Build a Python (Django) web app with PostgreSQL in Azure App Service". However, the requirements.txt file in this repo uses pyscopg2-binary which is not the recommended library for production. There is nothing in the doc that suggests that the pyscopg2-binary libary should be avoided for production which can give developers the impression that this is the standard library that should be used.
The problem is that pyscopg2 does not install on Azure App Service for Linux because the container doesn't have the dependency to build pyscopg2. So there is no choice but to use pyscopg2-binary. If there is a walk-through on the Azure docs to deploy a Django app with Postgres then the container that is used for Azure app service should be able to build psycopg2 which is the recommendation for production. I think it is very misleading otherwise.
The text was updated successfully, but these errors were encountered: