Search code examples
djangomongodbherokudjango-mongodb-engine

"'django_mongodb_engine' isn't an available database backend" when pushing to Heroku


I have a Django app that successfully ran on Heroku and uses mongodb engine. All of a sudden, I can not push it anymore. It does not seem to recognize the django_mongodb_engine module anymore. I even reverted all changes to the version that last ran, but it's still the same. I suspect a version conflict or so, but can not figure out how to fix it.

This is the error I'm getting:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/commands/shell.py", line 46, in handle_noargs
    from django.db.models.loading import get_models
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 51, in load_backend
    raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django_mongodb_engine' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of:
    'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named utils

And these are the important parts from the requirements.txt:

hg+https://bitbucket.org/wkornewald/django-nonrel
git+https://github.com/django-nonrel/mongodb-engine
hg+https://bitbucket.org/wkornewald/djangotoolbox

pymongo==2.2.1
pytz==2012d

I'm especially confused because I reverted all changes. Exactly this code with the same configuration ran perfectly (and still does on my production server), just pushing does not work.

Thanks Simon


Solution

  • Of course, just when I asked on SO I figure out the answer :-)

    I don't know why exactly, but defining the exact revision that i want to check out solved the problem.

    So the requirements.txt looks now like this:

    -e hg+http://bitbucket.org/wkornewald/django-nonrel@be48c152abc6b15e45155e2bbcfd69c665ccb536#egg=Django-dev
    -e git+https://github.com/django-nonrel/mongodb-engine@52257b5d90dcfaa564e708264a9cfe591d301fe6#egg=django_mongodb_engine-dev
    -e hg+https://bitbucket.org/wkornewald/djangotoolbox@a8cdf61ba9c0cdc7cbbbd37d693e9a222d9a8e5f#egg=djangotoolbox-dev
    
    pymongo==2.2.1
    pytz==2012d