2

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',
  }
}
Nicolas Cortot
  • 6,591
  • 34
  • 44
Pat Wangrungarun
  • 516
  • 4
  • 12

2 Answers2

2

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.

Pat Wangrungarun
  • 516
  • 4
  • 12
  • does this mean that the deployed version will work on postgresql and on the development (localhost) will work on mongodb !? – Fady Kamal Aug 09 '12 at 12:42
0

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

Jonas H.
  • 2,331
  • 4
  • 17
  • 23