Django settings.DATABASE 错误
Django settings.DATABASE error
编辑
我在迁移时收到此错误:
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
我的 settings.py 数据库配置是这样的:
DATABASES = {
'default': {},
'db1': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'metrix1',
'USER': 'appserver',
'PASSWORD': '***',
'HOST': 'localhost',
'PORT': '2323',
},
'db2': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'metrix2',
'USER': 'appserver',
'PASSWORD': '***',
'HOST': 'localhost',
'PORT': '2324',
},
}
任何帮助都会很棒!谢谢
编辑
这部分已修复
用户凭据有错字。
也出现此错误——不确定它是否与我收到的 settings.DATABASES 错误有关:
OperationalError at /counters_app/
(1045, "Access denied for user 'appserver'@'localhost' (using password: YES)")
Request Method: POST
Request URL: http://127.0.0.1:8000/counters_app/
Django Version: 1.9
Exception Type: OperationalError
Exception Value:
(1045, "Access denied for user 'appserver'@'localhost' (using password: YES)")
Exception Location: /usr/local/lib/python2.7/site-packages/MySQLdb/connections.py in __init__, line 204
Python Executable: /usr/local/opt/python/bin/python2.7
Python Version: 2.7.10
Python Path:
您必须配置'default'
数据库,根据settings documentation。
编辑 我在迁移时收到此错误:
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
我的 settings.py 数据库配置是这样的:
DATABASES = {
'default': {},
'db1': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'metrix1',
'USER': 'appserver',
'PASSWORD': '***',
'HOST': 'localhost',
'PORT': '2323',
},
'db2': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'metrix2',
'USER': 'appserver',
'PASSWORD': '***',
'HOST': 'localhost',
'PORT': '2324',
},
}
任何帮助都会很棒!谢谢
编辑 这部分已修复 用户凭据有错字。
也出现此错误——不确定它是否与我收到的 settings.DATABASES 错误有关:
OperationalError at /counters_app/
(1045, "Access denied for user 'appserver'@'localhost' (using password: YES)")
Request Method: POST
Request URL: http://127.0.0.1:8000/counters_app/
Django Version: 1.9
Exception Type: OperationalError
Exception Value:
(1045, "Access denied for user 'appserver'@'localhost' (using password: YES)")
Exception Location: /usr/local/lib/python2.7/site-packages/MySQLdb/connections.py in __init__, line 204
Python Executable: /usr/local/opt/python/bin/python2.7
Python Version: 2.7.10
Python Path:
您必须配置'default'
数据库,根据settings documentation。