I am using MongoEngine(0.9) and pymango(2.8) with django (1.8).
I create a database named "Dummy". when I create super user by ./manage.py createsuperuser . Now when i am trying to login in django Admin it throws a error 'MetaDict' object has no attribute 'pk'
my settings.py
import os
import mongoengine
from mongoengine import connect
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
mongoengine.connect('dummy', host='localhost')
SECRET_KEY = '_d!@y@jkwpnml%96amis1!)rz5&e-jpr)s2#1yc+k77yqoyq@u'
DEBUG = True
ALLOWED_HOSTS = []
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',
'rest_framework',
'mongoengine.django.mongo_auth',
'app'
)
SITE_ID='56c17b151eea0d0f74c29839'
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'TestAppProject.urls'
WSGI_APPLICATION = 'TestAppProject.wsgi.application'
ADMINS = (
('cp', '[email protected]'),
)
MANAGERS = ADMINS
MONGODB_DATABASES = {
'default': {'name': 'django_mongoengine'}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.dummy',
# 'default':'sqlite://db/sqlite3.db',,
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
AUTH_USER_MODEL = 'mongo_auth.MongoUser'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
Models.py
from django.db import models
from mongoengine import *
class Blog(Document):
owner = StringField()
title = StringField()
# extensions = ListField(EmbeddedDocument(BlogExtension))
tags = ListField(StringField())
approved = BooleanField()
Now I am stuck.Please help me what the error is this i searched a lot but i am unable to solve this error. Thanks in advance
models.pyfile.mongoengine.connect('dummy', host='localhost');and why you wrote connect 2 times,mongoengine.connectis the same asconnect