Home django connection to mongo and postgres
Reply: 2

django connection to mongo and postgres

Melany Published in 2018-02-14 04:51:50Z

I need to connect to my web app in django to mongodb and postgresql to do CRUD operations on it, here is the code of the project that it´s on git hub.

Here is the file where I made the connections to mongodb (isn´t working).

And this is the link of the project

Jerin Peter George
Jerin Peter George Reply to 2018-02-14 05:00:35Z

For mongo-db connection, try this in your settings.py as described in official doc

   'default' : {
      'ENGINE' : 'django_mongodb_engine',
      'NAME' : 'my_database'

For PostgreSQL, you need to do some pre-installation as mentioned in this stackoverflow answer

Sanjay Pradeep
Sanjay Pradeep Reply to 2018-02-15 07:43:51Z

Here is the info which might be useful to setup Mongo DB and PostgreSQL.

For Mongo DB connection setup,

  'default' : {
  'ENGINE' : 'django_mongodb_engine',
  'NAME' : 'my_database'

For PostgreSQL connection setup,

'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'your_project_name',
    'USER': 'project_user',
    'PASSWORD': 'password',
    'HOST': 'localhost',
    'PORT': '',

Connection setup must be added in settings.py file. Hope you know that.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300945 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO