인프런 커뮤니티 질문&답변

네동님의 프로필 이미지
네동

작성한 질문수

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트

장고가 media 파일을 다루는 방법

안녕하세요 11강 듣고 있는데요

해결된 질문

작성

·

230

0

File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 172, in handle self.handle_one_request() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 197, in handle_one_request handler.run(self.server.get_app()) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 145, in run self.handle_error() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 119, in handle_error super().handle_error() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 381, in handle_error self.finish_response() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 184, in finish_response self.write(data) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 287, in write self.send_headers() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 344, in send_headers if not self.origin_server or self.client_is_modern(): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 357, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable ---------------------------------------- [22/Dec/2021 10:44:50] "GET /admin/ HTTP/1.1" 200 5328 Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 196, in finish_response self.close() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 114, in close super().close() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\simple_server.py", line 38, in close SimpleHandler.close(self) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 334, in close self.result.close() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\http\response.py", line 253, in close signals.request_finished.send(sender=self._handler_class) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\dispatch\dispatcher.py", line 175, in send for receiver in self._live_receivers(sender) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\dispatch\dispatcher.py", line 175, in <listcomp> for receiver in self._live_receivers(sender) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\__init__.py", line 57, in close_old_connections conn.close_if_unusable_or_obsolete() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\base\base.py", line 525, in close_if_unusable_or_obsolete self.close() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 261, in close if not self.is_in_memory_db(): File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 380, in is_in_memory_db return self.creation.is_in_memory_db(self.settings_dict['NAME']) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db return database_name == ':memory:' or 'mode=memory' in database_name TypeError: argument of type 'WindowsPath' is not iterable [22/Dec/2021 10:44:50] "GET /admin/ HTTP/1.1" 500 59 ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 11359) Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run self.finish_response() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 196, in finish_response self.close() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 114, in close super().close() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\simple_server.py", line 38, in close SimpleHandler.close(self) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 334, in close self.result.close() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\http\response.py", line 253, in close signals.request_finished.send(sender=self._handler_class) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\dispatch\dispatcher.py", line 175, in send for receiver in self._live_receivers(sender) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\dispatch\dispatcher.py", line 175, in <listcomp> for receiver in self._live_receivers(sender) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\__init__.py", line 57, in close_old_connections conn.close_if_unusable_or_obsolete() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\base\base.py", line 525, in close_if_unusable_or_obsolete self.close() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 261, in close if not self.is_in_memory_db(): File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 380, in is_in_memory_db return self.creation.is_in_memory_db(self.settings_dict['NAME']) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db return database_name == ':memory:' or 'mode=memory' in database_name TypeError: argument of type 'WindowsPath' is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 650, in process_request_thread self.finish_request(request, client_address) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 720, in __init__ self.handle() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 172, in handle self.handle_one_request() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 197, in handle_one_request handler.run(self.server.get_app()) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 145, in run self.handle_error() File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\django\core\servers\basehttp.py", line 119, in handle_error super().handle_error() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 381, in handle_error self.finish_response() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 184, in finish_response self.write(data) File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 287, in write self.send_headers() File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 344, in send_headers if not self.origin_server or self.client_is_modern(): File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 357, in client_is_modern return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable
 
이렇게 콘솔창에 나와서 무슨 에러 내용인지 모르겠어요!
 
그리고
 
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' TypeError: 'NoneType' object is not subscriptable
 
이렇게 나와버려서 일단 웹에서 실행은 돼요.
 
비주얼스튜디오 코드로 진행하고 있구요
 
 

답변 1

0

이진석님의 프로필 이미지
이진석
지식공유자

안녕하세요.

수많은 강의를 하며 수많은 분들의 에러를 봐왔지만, 저도 이런 경우는 처음 보네요. 흠.

보여주신 에러에서 self.environ['SERVER_PROTOCOL'] 에서 TypeError: 'NoneType' object is not subscriptable 오류가 발생하는 것은 self.environ 이 None이라는 것인데요.

디버거를 물려서 하나하나 체크해보지 않는 다음에야 규명이 어려울 듯 합니다.

파이썬과 가상환경을 제거 후에, 최신 버전의 python을 설치하시고 다시 시도해보시면 어떨까요?

네동님의 프로필 이미지
네동

작성한 질문수

질문하기