2011-01-23 2 views
0

모듈 식 설정 파일을 만들려고합니다. settings.py모듈화 장고 설정 파일에서 ImportError를 사용합니다.

config_module = __import__('other', globals(), locals()) 

에서이 라인

project/ 
    settings.py 
    other.py 

다음은 ImportError를 제기하는 동안 :이 라인으로

project/ 
    settings.py 
    config/ 
    other.py 

왜이 작동하는지 그 것이다 settings.py :

config_module = __import__('config.other', globals(), locals()) 
+1

config 디렉토리에'__init __. py'가 누락 되었습니까? –

답변

2

config 디렉토리에 __init__.py 파일이 누락되어 모듈로 취급되기를 원하는 것처럼 보입니다. __init__.py 파일은 비어있을 수 있지만 존재해야합니다.

관련 문제