Heroku push of django app gets "No module named psycopg2.extensions"

I installed psycopg2-binary.

pip install psycopg2-binary

added to requirements.txt file.

Committed and pushed the code and it worked.


You need to add the psycopg2 installation to your requirements.txt file. It is the database adapter - the way python interfaces with the PostgreSQL you indeed do not need to install because heroku does.

Just add the line psycopg2==2.4.4 to your requirements.txt file.

The database add-on addition itself, by the way, is not necessary. dj-database-url takes care of it automatically. Check out the heroku docs for a step-by-step guide.