我启动了Django项目,但是数据库设置出现了错误。网页运作良好:
It worked!
Congratulations on your first Django-powered page.
Of course, you haven't actually done any work yet. Next, start your first app by
running python manage.py startapp [appname].
You're seeing this message because you have DEBUG = True in your Django settings file
and you haven't configured any URLs. Get to work!但是我知道这个错误是控制台:
settings.DATABASES is improperly configured. Please supply the ENGINE
value. Check settings documentation for more details.
Request Method: GET Request URL: http://fireidea.net/ Django
Version: 1.6.2 Exception Type: ImproperlyConfigured Exception Value:
settings.DATABASES is improperly configured. Please supply the ENGINE
value. Check settings documentation for more details.
Exception Location:
/home2/minhhien/webapps/django/django/db/backends/dummy/base.py in
complain, line 15 Python Executable: /usr/bin/python Python Version:
2.7.5
...数据库设置:
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = ''
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
#DATABASES = {
# 'default': {
# 'ENGINE': '',
# 'NAME': '',
# 'HOST': 'localhost',
# 'PORT': '',
# 'USER': '',
# 'PASSWORD': ''
# }
#}发布于 2014-02-27 06:03:55
Django 1.6期望数据库是一本字典。您将其注释掉,并在其中放置一些较旧的设置格式。您应该将其更改为:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '',
'HOST': 'localhost',
'PORT': '',
'USER': '',
'PASSWORD': ''
}
}在这里可以看到更多关于这个的信息:https://docs.djangoproject.com/en/1.6/ref/databases/
发布于 2014-02-27 06:06:49
您正在使用的设置变量DATABASES_*,这已经是遭到反对的Django 1.2,5年前现在!
您需要使用字典,因为默认设置可能已为您预先填充:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '',
'HOST': 'localhost',
'PORT': '',
'USER': '<user>',
'PASSWORD': ''
}
}https://stackoverflow.com/questions/22060182
复制相似问题