Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

The application with mongoengine don't run

40 views
Skip to first unread message

Paulo Bentes

unread,
Feb 26, 2023, 2:37:58 PM2/26/23
to MongoEngine Users

When I am trying create and run a container the terminal returns this erros message:

AttributeError: module 'mongoengine.base' has no attribute 'DatabaseWrapper'

and don't start the container.

My configuration in settings.py is:

import mongoengine

DATABASES = {
    'default': {
        'ENGINE': 'mongoengine',
        'NAME': 'database',
        'CLIENT': {
            'host': 'mongodb://mongo:27017/',
            'username': 'admin',
            'password': 'mysenha',
            #'authSource': 'admin',
            #'authMechanism': 'SCRAM-SHA-1',
        },
    },
}

SESSION_ENGINE = 'mongoengine.django.sessions'
SESSION_SERIALIZER = 'mongoengine.django.sessions.BSONSerializer'



INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'mongoengine',
    'handleleads',
    'app',
]

and others


The file requirements.txt is:

Django==3.2.9
gunicorn==20.1.0
mongoengine==0.26.0

and in docker-compose I have:

mongo:
    image: mongo
    restart: always
    volumes:
      - ./mongo-data:/data/db

    environment:
      MONGO_INITDB_ROOT_USERNAME: admin
      MONGO_INITDB_ROOT_PASSWORD: mysenha
    ports:
      - "27017:27017"

The mongo's container and the db inside is runing normal.
Any idea?

Reply all
Reply to author
Forward
0 new messages