2012-06-19 2 views
0

안녕하세요. 도움을 위해 미리 감사드립니다. 나는 방금 Python과 Django를 배우기 시작했고 djangoproject.com에서 튜토리얼을 설정하려고 노력하고있다. 나는 서버를 설정하기 위해 노력했지만이 오류가 계속 : I 스포트 라이트를 사용하여 sqlite3.db.base를 찾기 위해 노력했습니다오류 : django에서 서버를 설정하려고 할 때 sqlite3.db.base 모듈이 없습니다.

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x108826090>> 
Traceback (most recent call last): 
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run 
self.validate(display_num_errors=True) 
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 266, in validate 
num_errors = get_validation_errors(s, app) 
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors 
from django.db import models, connection 
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 40, in <module> 
backend = load_backend(connection.settings_dict['ENGINE']) 
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 34, in __getattr__ 
return getattr(connections[DEFAULT_DB_ALIAS], item) 
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 92, in __getitem__ 
backend = load_backend(db['ENGINE']) 
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 44, in load_backend 
raise ImproperlyConfigured(error_msg) 
django.core.exceptions.ImproperlyConfigured: 'django.db.sqlite3.db' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of: 
'dummy', 'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3' 
Error was: No module named sqlite3.db.base 

하지만 모듈을 찾을 수 없습니다. 내가 터미널 및 가져 오기 sys 및 sqlite3 가져올 때 어떤 오류가 가져 오지. 터미널에서 sys.path에 나와 있습니다 : 다시

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.sqlite3.db', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 
     'NAME': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',  # Or path to database file if using sqlite3. 
     'USER': '',      # Not used with sqlite3. 
     'PASSWORD': '',     # 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. 
    } 
} 

감사 :

['', 
'/Library/Python/2.7/site-packages/pip-1.1-py2.7.egg', 
'/Library/Python/2.7/site- packages/distribute-0.6.27-py2.7.egg', 
'/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', 
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', 
'/Library/Python/2.7/site-packages', 
'/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info'] 

현재 내 settings.py로 설정되어 있습니다!

답변

9

ENGINE 설정을 변경했습니다. django.db.backends.sqlite3이어야합니다.

+0

감사합니다. Daniel, works! – Jonathan

1

가져 오기와 관련이 없습니다. ENGINE 설정에 잘못 입력했습니다. 다음과 같아야합니다.

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.                
     'NAME': join(CURRENT_DIR, 'db/cms.db'), # Or path to database file if using sqlite3.                    
     'USER': '',      # Not used with sqlite3.                           
     'PASSWORD': '',     # 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.                   
    } 
} 
+0

안녕하세요 folex 내가 ENGINE 및 NAME 설정으로 설정을 변경하면 빠른 응답을 보내 주셔서 감사합니다. 오류 이름 'join'이 정의되지 않았습니까? – Jonathan

+0

오, db 이름을 적절한 것으로 변경해야합니다. – folex

+0

아, 알겠습니다. 'NAME': 데이터베이스 파일의 경로입니다. – folex

관련 문제