Mongoengine: ConnectionError: You have not defined a default connection

后端 未结 3 1008
南笙
南笙 2020-12-19 02:34

In my new Django project I set up a MongoDb database and use mongoengine module but I can\'t properly access to dabase nore in shell no in views. \"ConnectionError: You have

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 02:59

    In your settings.py file replace:

    mongoengine.connect(_MONGODB_NAME, 'localhost:27017')
    

    with the below code (notice the added 'host='):

    mongoengine.connect(_MONGODB_NAME, host='localhost:27017')
    

提交回复
热议问题