pytest 오류모음
2019. 6. 30. 19:34

django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
해결방법
$ export DJANGO_SETTINGS_MODULE='config.settings' <-- 터미널에 명령어 입력
혹은프로젝트 root directory에 pytest.ini 라는 파일을 만들고
[pytest]
DJANGO_SETTINGS_MODULE = yourproject.settings 입력
python_files = tests.py test_*.py *_tests.py(테스트파일 못찾을때 같이 입력)

Anonymous, mixer같은 모듈을 불러오지 못함
해결방법
$ pip install pytest-django (django-pytest 가 아님에 주의)

db를 못찾음
해결방법
해당 함수에 데코레이터 삽입 @pytest.mark.django_db
'today's error' 카테고리의 다른 글
django-admin 으로 startproject 를 시도할 때 모듈 이름이 충돌나는 경우 (0) | 2019.08.12 |
---|---|
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx가 작동하지 않아요 (0) | 2019.06.02 |