Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8913433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:27:49+00:00 2026-06-15T04:27:49+00:00

I’m trying to push a django app to heroku and getting an error that

  • 0

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.

I’m not sure where to proceed; I see nothing in any of the docs that says what is wrong. The main error is:

ImportError: No module named psycopg2.extensions

…but heroku’s configuration is the one that is setting that as the ENGINE, I don’t know how to get by it.

My conversation with heroku to make sure it knows about postgres

$ 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://<blah-blah-blah>@ec2-<ip-address>.compute-1.amazonaws.com:5432/<blah-blah>
$ heroku pg:promote HEROKU_POSTGRESQL_OLIVE_URL
Promoting HEROKU_POSTGRESQL_OLIVE_URL to DATABASE_URL... done

My requirements.txt:

Django==1.4.2
wsgiref==0.1.2
dj-database-url==0.2.1

A snippet from my settings.py:

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

When I push to heroku, I get this from heroku logs:

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': '<blah blah>', 'HOST': 'ec2-<iip-address>.compute-1.amazonaws.com', 'USER': '<blah blah>', 'PASSWORD': '<blah>', '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 <module>
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 <module>
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 <module>
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 <module>
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:27:50+00:00Added an answer on June 15, 2026 at 4:27 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.