title: Heroku push of django app gets "No module named psycopg2.extensions"
body: <p>I'm trying to push a django app to heroku and getting an error that I haven't seen anywhere in the heroku or stackoverflow forums.  I'm using postgres.</p>
  
  <p>I'm not sure where to proceed; I see nothing in any of the docs that says what is wrong.  The main error is:</p>
  
  <p><strong>ImportError: No module named psycopg2.extensions</strong></p>
  
  <p>...but heroku's configuration is the one that is setting that as the ENGINE, I don't know how to get by it.</p>
  
  <p>My conversation with heroku to make sure it knows about postgres</p>
  
  <pre><code>$ heroku addons:add heroku-postgresql:dev
  Adding heroku-postgresql:dev on morning-crag-1585... done, v24 (free)
  Attached as HEROKU_POSTGRESQL_OLIVE_URL
  Database has been created and is available
   ! This database is empty. If upgrading, you can transfer
   ! data from another database with pgbackups:restore.
  .
  Use `heroku addons:docs heroku-postgresql:dev` to view documentation.
  $ heroku pg:wait 
  $ heroku config | grep HEROKU_POSTGRESQL
  HEROKU_POSTGRESQL_OLIVE_URL: postgres://&lt;blah-blah-blah&gt;@ec2-&lt;ip-address&gt;.compute-1.amazonaws.com:5432/&lt;blah-blah&gt;
  $ heroku pg:promote HEROKU_POSTGRESQL_OLIVE_URL
  Promoting HEROKU_POSTGRESQL_OLIVE_URL to DATABASE_URL... done
  </code></pre>
  
  <p>My requirements.txt:</p>
  
  <pre><code>Django==1.4.2
  wsgiref==0.1.2
  dj-database-url==0.2.1
  </code></pre>
  
  <p>A snippet from my settings.py:</p>
  
  <pre><code>print "Got here before!\n"
  try:
    import dj_database_url
    DATABASES = { 'default': dj_database_url.config(default='postgres://localhost') }
  except:
    print "Unexpected error:", sys.exc_info()
  
  print DATABASES
  </code></pre>
  
  <p>When I push to heroku, I get this from <code>heroku logs</code>:</p>
  
  <pre><code>heroku[slugc]: Slug compilation finished
  heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:30550 --noreload`
  app[web.1]: Got here before!
  app[web.1]: 
  app[web.1]: {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '&lt;blah blah&gt;', 'HOST': 'ec2-&lt;iip-address&gt;.compute-1.amazonaws.com', 'USER': '&lt;blah blah&gt;', 'PASSWORD': '&lt;blah&gt;', 'PORT': 5432}}
  app[web.1]: 
  app[web.1]: Validating models...
  app[web.1]: Traceback (most recent call last):
  app[web.1]:   File "./manage.py", line 10, in &lt;module&gt;
  app[web.1]:     execute_from_command_line(sys.argv)
  app[web.1]:     utility.execute()
  app[web.1]:     self.execute(*args, **options.__dict__)
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
  app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
  app[web.1]:     self.inner_run(*args, **options)
  app[web.1]:     self.validate(display_num_errors=True)
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
  app[web.1]:     num_errors = get_validation_errors(s, app)
  app[web.1]:     self.run(*args, **options)
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
  app[web.1]:     output = self.handle(*args, **options)
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
  app[web.1]:     from django.db import models, connection
  app[web.1]:     return import_module('.base', backend_name)
  app[web.1]:     __import__(name)
  app[web.1]: ImportError: No module named psycopg2.extensions
  app[web.1]:     return getattr(connections[DEFAULT_DB_ALIAS], item)
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/creation.py", line 1, in &lt;module&gt;
  app[web.1]:     backend = load_backend(db['ENGINE'])
  app[web.1]:     import psycopg2.extensions
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 40, in &lt;module&gt;
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 69, in handle
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 80, in run
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
  app[web.1]:     backend = load_backend(connection.settings_dict['ENGINE'])
  app[web.1]:     from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
  app[web.1]:   File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 13, in &lt;module&gt;
  heroku[web.1]: Process exited with status 1
  heroku[web.1]: State changed from starting to crashed
  </code></pre>