문제

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': ''
#    }
#}
.

도움이 되었습니까?

해결책

Django 1.6은 데이터베이스가 사전이 될 것으로 기대합니다. 당신은 그것에 대해 논평하고 그 오래된 설정 형식을 거기에 넣습니다. 다시 변경해야합니다 :

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '',
        'HOST': 'localhost',
        'PORT': '',
        'USER': '',
        'PASSWORD': ''
    }
}
.

https://docs.djangoproject.com/ko/ko/1.6/ref/databases/

다른 팁

이미 설정 변수를 사용하고 있음은 이미 Django에서 더 이상 사용되지 않습니다.1.2 , 5 년 전 지금!

기본 설정이 미리 채워질 수 있으므로 사전을 사용해야합니다.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '',
        'HOST': 'localhost',
        'PORT': '',
        'USER': '<user>',
        'PASSWORD': ''
    }
}
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top