-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
문제상황
ALLOWED_HOSTS에 현재 호스트가 추가되어 있지 않을때 (ex. 로컬에서 localhost), 다음과 같은 오류가 발생합니다.
Traceback (most recent call last):
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/sentry_sdk/integrations/django/middleware.py", line 134, in __call__
return f(*args, **kwargs)
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/sentry_sdk/integrations/django/middleware.py", line 90, in sentry_wrapped_method
return old_method(*args, **kwargs)
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/django/utils/deprecation.py", line 93, in __call__
response = self.process_request(request)
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/django/middleware/common.py", line 47, in process_request
host = request.get_host()
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/django/http/request.py", line 111, in get_host
raise DisallowedHost(msg)
django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'localhost:8000'. You may need to add 'localhost' to ALLOWED_HOSTS.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/shwjdgns/repo/work/sparcssso/venv/lib/python3.6/site-packages/django/utils/translation/__init__.py", line 259, in get_language_info
lang_info = LANG_INFO[lang_code]
KeyError: ''
문제 원인은 호스트가 허용되지 않아 request 객체가 채워지지 않고, 그로 인해 현재 언어 정보도 나오지 않은 것으로 보입니다.
해결방법
default 값을 잘 설정
Metadata
Metadata
Assignees
Labels
No labels