Pat Wangrungarun
Pat Wangrungarun

Reputation: 526

Django + MongoDB on Heroku

I'd like to use Django with MongoDB on Heroku. In the their document, Getting Started with Django on Heroku/Cedar : Postgres Database Config, says that some code is appended to settings.py to use the DATABASE_URL.

Is there any way to avoid this ? Because the DATABASES needs to be django_mongodb_engine here, also with other settings, e.g. (example dragged from compSocSci)

DATABASES = {
  'default': {
    'ENGINE': 'django_mongodb_engine',
    'NAME': 'heroku_app1234567',
    'USER': 'heroku_app1234567',
    'PASSWORD': 'abcdefghijklmnopqrstuvwxyz',
    'HOST': 'ds031117.mongolab.com',
    'PORT': '31117',
  }
}

Upvotes: 2

Views: 3408

Answers (2)

Pat Wangrungarun
Pat Wangrungarun

Reputation: 526

Ok so I have figured out the way to do this after contact to Heroku support.
All you have to do is remove the shared PostgreDB addon and the injected code
would not modify the DATABASES.

$ heroku addons:remove shared-database:5mb

And note that you still need to include psycopg2 in your requirements.txt.

Upvotes: 2

Jonas H.
Jonas H.

Reputation: 2491

It should work if you simply don't specify DATABASE_URL (if that' possible at all).

Upvotes: 0

Related Questions