0

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

6
  • post the full code exists in models.py file. Commented Feb 15, 2016 at 7:38
  • can you check this stackoverflow.com/a/18317318/4117381 Commented Feb 15, 2016 at 7:53
  • why there is a semicolon here mongoengine.connect('dummy', host='localhost'); and why you wrote connect 2 times, mongoengine.connect is the same as connect Commented Feb 15, 2016 at 7:58
  • I have only this code in my models.py Commented Feb 15, 2016 at 8:09
  • I delete the repetted data from my settings.py Commented Feb 15, 2016 at 8:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.