It seems like Heroku does not support python-ldap. The pip install with "python-ldap==2.3.13" in the requirements.txt file failed with following error in Heroku:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.13 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/local/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o
Modules/LDAPObject.c:18:18: error: sasl.h: No such file or directory
It seems like Heroku does not have the libraries required for python-ldap and I don't know if there is a way to install dependency libraries except 'pip'.
What is the recommended solution to support ldap authentications in Heroku's Python/Django stack?
Your help is greatly appreciated.
You can create a custom build pack that vendors in any libraries you like. Take a look at https://github.com/cirlabs/heroku-buildpack-geodjango it installs a library via Curl.
I know this question is old, but I had the same problem and Google brought me here. I'll write what I found so maybe I can help people that have the same problem and want a currently working solution.
As @Schneems said you can create your own buildpack using heroku and add your custom environment.
You can create a custom buildpack containing python-ldap, but, creating a custom buildpack from zero is not really an option for some, so you can fork the official python buildpack https://github.com/heroku/heroku-buildpack-python and add it python-ldap as @damgad did.
The problem here is that the repo from @damgad is outdated compared to the recent version of the official python/buildpack. (At the time of this comment)
I found this pull request(now closed) https://github.com/heroku/heroku-buildpack-python/pull/271 from a guy that used @damgad code and created his own fork https://github.com/josegonzalez/heroku-buildpack-python.
I tried using it, but his repo was outdated and got some errors deploying my app.
So I just created my own fork of the currently official heroku/python buildpack added it https://github.com/josegonzalez/heroku-buildpack-python. code, fixed just some errors I was getting and you have this currently working buildpack with python-ldap https://github.com/manuggz/heroku-buildpack-python.
This buildpack supports python3.6 and thats all I wanted.
Tl;dr You have to use this updated buildpack if you want to use python-ldap (or create your own forking the official buildpack):
$ heroku buildpacks:set https://github.com/manuggz/heroku-buildpack-python
I recelntly created heroku buildpack that supports python-ldap
. It's availabale on my github repo.
To make it work you only need to specify environment variable like that:
heroku config:set BUILDPACK_URL=https://github.com/damgad/heroku-buildpack-python-ldap.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With