NotperlyConfigured:settings.DATABASES配置不正确。请提供ENGINE值
自从过去3天以来,我一直在遭遇这个问题。
我已经在不同的博客(甚至是stackoverflow)和解决方案上看到了重复票的音调,但是没有一个在我身上发挥作用。
最后我别无选择,只能在我的settings.py中询问这里有什么问题,为什么即使在新的AWS实例上移动django应用程序后问题仍未解决。
我的setting.py:
# Django settings for smartDNA project.
import os
import sys
import logging
from django.conf import settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
WINDOWS=False
#EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
EMAIL_USE_SSL = True
#EMAIL_USE_TLS = True
EMAIL_HOST = 'xxx.xxx.xxx.xxx'
EMAIL_PORT = 80
EMAIL_HOST_USER = 'xxxx@xxxx'
EMAIL_HOST_PASSWORD = 'xxxxxxx'
DEFAULT_FROM_EMAIL = 'xxx.xxx@xxxx'
DEFAULT_TO_EMAIL = 'xxxxx.xxxx@xxxx'
ADMINS = (
('XXXX', 'XXXX@xxxxxx'),
)
#SESSION_COOKIE_DOMAIN="http://ec2-xx-xx-xx-xxx.compute-1.amazonaws.com"
SESSION_COOKIE_NAME = 'site2'
#SESSION_COOKIE_PATH =':/tmp'
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'livedb1', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': 'SMARTDNA', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# system time zone.
TIME_ZONE = 'Asia/Calcutta'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
if WINDOWS:
MEDIA_ROOT = ('%s/media/' % (os.path.dirname(__file__))) #'D:/smartDNA/media/'
else:
MEDIA_ROOT = ('%s/media/' % (os.path.dirname(__file__))) #'/home/ubuntu/server/smartDNA/media/'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
if WINDOWS:
STATIC_ROOT = ('%s/static/' % (os.path.dirname(__file__))) #'D:/smartDNA/static/'
else:
STATIC_ROOT = ('%s/static/' % (os.path.dirname(__file__))) #'/home/ubuntu/server/smartDNA/static/'
# STATIC_ROOT = '/home/ubuntu/server/smartDNA/static'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.static",
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
'djangobower.finders.BowerFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = '192(q1m!d)k9n)gdq$1d^e7p4%n*3gsbb0waubmuftw)*0lt__'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)
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',
#'smartDNA.trackware.UserLocationLoggerMiddleware',
'pagination.middleware.PaginationMiddleware',
)
ROOT_URLCONF = 'smartDNA.urls'
if WINDOWS:
TEMPLATE_DIRS = ('%s/templates' % (os.path.dirname(__file__))) #('D:/smartDNA/templates',)
else:
TEMPLATE_DIRS = ('%s/templates' % (os.path.dirname(__file__))) #('/home/ubuntu/server/smartDNA/templates',)
INSTALLED_APPS = (
#'grappelli',
#'grappelli.dashboard',
'suit',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'smartDNA.core',
'googlecharts',
'pagination',
)
settings.configure()
ADMIN_REORDER = (
("core", ("Alert","Verification","AlertSubscriber","Anomaly","Logger","AssetWithPeriodicScanPolicy")),
)
# Django Suit configuration example
SUIT_CONFIG = {
# header
'ADMIN_NAME': 'XXXXX RETAIL SECURITY PROGRAMME',
'HEADER_DATE_FORMAT': 'l, j. F Y',
'HEADER_TIME_FORMAT': 'H:i',
# forms
'SHOW_REQUIRED_ASTERISK': True, # Default True
'CONFIRM_UNSAVED_CHANGES': True, # Default True
# menu
'SEARCH_URL': '/admin/auth/user/',
'MENU_ICONS': {
'sites': 'icon-leaf',
'auth': 'icon-lock',
'core': 'icon-globe'
},
'MENU_OPEN_FIRST_CHILD': True, # Default True
'MENU_EXCLUDE': ('auth.group',),
'MENU': (
'sites',
{'app': 'core', 'icon':'icon-globe', 'models': ('Verification', 'Verification')},
{'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
{'label': 'Settings', 'icon':'icon-cog', 'models': ('auth.user', 'auth.group')},
{'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
),
# misc
'LIST_PER_PAGE': 15
}
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
GEOIP_PATH = "/home/ubuntu/xxxxx/smartDNA/"
最近我的项目在Django 1.4上运行,但由于一些smartbyte编码错误,我更新到1.5。在那个问题开始后我降级到Django 1.4。它甚至在降级之后都没有进行,然后我将整个项目转移到新的AWS实例(ubuntu 14.04)。
我正在使用Django 1.5 python2.7
答案 0 :(得分:2)
settings.configure()
似乎凌驾于私密环境之上。这一定是您问题的关键。
事实上,如果你在没有任何参数的情况下调用configure(),django将使用默认设置,通常没有在其中定义任何数据库引擎,因此你会得到错误。