2

이렇게 장고/MongoDB를 설치하고 구성했습니다!오류 : django_mongodb_engine.base 모듈이 없습니다.

설치 PIP VIRTUALENV

소스에 MyProject/빈/

가 HG + HTTPS를 설치 픽처 인 픽처 활성화 : HG + HTTPS를 설치 PIP

//bitbucket.org/wkornewald/django-nonrel : //bitbucket.org/wkornewald/djangotoolbox

자식 + https를 설치 PIP :

//github.com/django-nonrel/mongodb-engine을

이러한 모든 작업은 성공적입니다. 분명히

Error was: No module named django_mongodb_engine.base 

성공적으로 설치 한 django_mongodb_engine :

DATABASES = { 
    'default': { 
     'ENGINE': 'django_mongodb_engine', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
     'NAME': 'mong_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. 
    } 

마음 절곡 오류가 발생 :이 방법은 같은 settings.py 파일을 변경 이제

. 하지만 왜이 오류가 나타 납니까?

btw, 내 불쌍한 영어를 용서하십시오!

답변

1

그럼, 당신이했던 것과 같은 단계를 통해 갔다 파이썬 쉘 열 :

$ python 
>>> import django_mongodb_engine.base 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Users/emptysquare/.virtualenvs/foo/lib/python2.7/site-packages/django_mongodb_engine/base.py", line 4, in <module> 
    from django.db.backends.signals import connection_created 
    File "/Users/emptysquare/.virtualenvs/foo/lib/python2.7/site-packages/django/db/__init__.py", line 14, in <module> 
    if not settings.DATABASES: 
    File "/Users/emptysquare/.virtualenvs/foo/lib/python2.7/site-packages/django/utils/functional.py", line 276, in __getattr__ 
    self._setup() 
    File "/Users/emptysquare/.virtualenvs/foo/lib/python2.7/site-packages/django/conf/__init__.py", line 40, in _setup 
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) 
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. 

을하지만 내가 할 경우 :

$ DJANGO_SETTINGS_MODULE=settings python 
>>> import django_mongodb_engine.base 

를 ... 그것은 작동합니다.

DJANGO_SETTINGS_MODULE을 (를) 설정하고 Python 셸에서 django_mongodb_engine.base를 가져올 수 있습니까?