我检查了可能导致此错误的所有可能位置,但无法了解该怎么做。 这是我的settings.py
# Django global settings
# This allows us to construct the needed absolute paths dynamically,
# e.g., for the GIS_DATA_DIR, MEDIA_ROOT, and TEMPLATE_DIRS settings.
# see: http://rob.cogit8.org/blog/2008/Jun/20/django-and-relativity/
import os
GEOGRAPHIC_ADMIN_DIR = os.path.dirname(__file__)
# http://docs.djangoproject.com/en/dev/topics/testing/#id1
# Your user must be a postgrest superuser
# Avoid specifying your password with: ~/.pgpass
# http://www.postgresql.org/docs/8.3/interactive/libpq-pgpass.html
T EST_RUNNER='django.contrib.gis.tests.run_gis_tests'
DEBUG=True
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'geoadmin'
DATABASE_USER = 'postgres' # make sure to change this to your postgres user
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
# Not used at this point but you'll need it here if you
# want to enable a google maps baselayer within your
# OpenLayers maps
GOOGLE_MAPS_API_KEY='abcdefg'
SHP_UPLOAD_DIR = r"/home/satyajit/geodjango/geographic_admin/data"
GIS_DATA_DIR = os.path.join(GEOGRAPHIC_ADMIN_DIR, 'data')
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/Vancouver'
SITE_ID = 1
USE_I18N = True
MEDIA_ROOT = os.path.join(GEOGRAPHIC_ADMIN_DIR, 'media')
MEDIA_URL = '/media/'
HAYSTACK_SITECONF='geographic_admin.search_sites'
HAYSTACK_SEARCH_ENGINE = 'xapian'
HAYSTACK_WHOOSH_PATH = '/home/satyajit/geodjango/geographic_admin/xapian-index'
ADMIN_MEDIA_PREFIX = '/admin_media/'
LOGIN_REDIRECT_URL = '/accounts/profile/'
SECRET_KEY = '2f!vq4!f)u#g-sk7_=z+i0e(o0o&hue5khxbdkdx$f%hvpb^vd'
LOGIN_URL='/accounts/login/'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
)
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.request',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
)
AUTH_PROFILE_MODULE = 'userprofile.profile'
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)
ROOT_URLCONF = 'urls'
STATIC_URL = '/static/'
STATIC_ROOT = "/home/satyajit/geodjango/geographic_admin/sitestatic"
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
TEMPLATE_DIRS = (
os.path.join(GEOGRAPHIC_ADMIN_DIR, 'templates'),
os.path.join(GEOGRAPHIC_ADMIN_DIR, '../registration/templates'),
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.databrowse',
'django.contrib.gis',
'django.contrib.staticfiles',
'world',
'maps',
'shapes',
'registration',
'waypoints',
'openmaps',
'permissions',
'floppyforms',
'OsmMap',
'userprofile',
'mapsearch',
'haystack',
)
ACCOUNT_ACTIVATION_DAYS=7
EMAIL_HOST='localhost'
EMAIL_PORT=1023
EMAIL_HOST_USER='username'
EMAIL_HOST_PASSWORD='password'
我得到的错误就是这个
raise ImproperlyConfigured('The HAYSTACK_SITECONF setting is no longer used & can be removed.')
django.core.exceptions.ImproperlyConfigured: The HAYSTACK_SITECONF setting is no longer used & can be removed.
所以我从settings.py中删除了SITECONF 我得到的错误就是这个
django.core.exceptions.ImproperlyConfigured: The HAYSTACK_SEARCH_ENGINE setting has been replaced with HAYSTACK_CONNECTIONS.
可能是什么问题?
我完全陷入困境。
答案 0 :(得分:1)
这看起来像你有django-haystack v.1.2.x设置并正在运行django-haystack 2.x
我要么恢复运行以前版本的django-haystack,要么使用如何从1.2迁移到2.0 documentation来重写HAYSTACK_*
文件的settings.py
部分。
另外 - 如果你想将你的django-haystack git repo回滚到1.2.4版本,只需发行(在回购中)
git reset --hard v1.2.4
答案 1 :(得分:0)
这是由HayStack版本引起的。这是最新版本Docs(1.2.7),支持HAYSTACK_SITECONF