我正在使用 neo4django(github 版本)在 Django 1.4.5 中构建应用程序。我目前正在尝试按照https://neo4django.readthedocs.org/en/latest/admin.html上的说明启用管理界面
当我点击 /admin 时,使用以下设置出现错误
settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
我的settings.py包括以下内容
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.dummy',
}
}
NEO4J_DATABASES = {
'default' : {
'HOST':'localhost',
'PORT':7474,
'ENDPOINT':'/db/data'
}
}
AUTHENTICATION_BACKENDS = ('neo4django.auth.backends.NodeModelBackend',)
SESSION_ENGINE = ('django.contrib.sessions.backends.file')
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.i18n',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
INSTALLED_APPS = (
'neo4django.auth',
'django.contrib.sessions',
'django.contrib.messages',
'neo4django.admin',
'neo4django.contenttypes',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.staticfiles',
'my_app',
'users',
)
我的网址.py
from django.conf.urls import patterns, include, url
from neo4django import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'my_app.views.MainHomePage', name='home'),
url(r'^admin/', include(admin.site.urls)),
)
我的模型.py
from neo4django.db import models
from neo4django.auth.models import User
class Person(models.NodeModel):
email = models.EmailProperty(required = True, unique = True, indexed = True)
# Neo4J RelationShips
user = models.Relationship(User, rel_type = 'is_user')
def __unicode__(self):
return u'%s' % (self.full_name.strip())
和我的admin.py(尽可能简单)
from django.contrib import admin
from neo4django.auth.models import User
from users.models import Person
class UserAdmin(admin.ModelAdmin):
pass
admin.site.register(User, UserAdmin)
class PersonAdmin(admin.ModelAdmin):
pass
admin.site.register(Person, PersonAdmin)
我曾尝试将 mysql 与 neo4j 一起使用,但我会得到no such table: django_site
错误,我必须首先运行 syncdb,至少要创建 django_site 表,或者我只是在成功后一直被重定向回管理员登录页面登录。
有人可以指出我正确的方向,或者至少告诉我是否可以只使用 neo4j?