TypeError: argument of type ‘WindowsPath‘ is not iterable,TypeError: ‘NoneType‘ object is not subs‘

Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[27/Dec/2022 07:40:02] "GET / HTTP/1.1" 200 5673
Traceback (most recent call last):
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 196, in finish_response
    self.close()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
    super().close()
  File "D:\Anaconda3\envs\django\lib\wsgiref\simple_server.py", line 38, in close
    SimpleHandler.close(self)
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 334, in close
    self.result.close()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\http\response.py", line 252, in close
    signals.request_finished.send(sender=self._handler_class)
  File "D:\Anaconda3\envs\django\lib\site-packages\django\dispatch\dispatcher.py", line 175, in send
    for receiver in self._live_receivers(sender)
  File "D:\Anaconda3\envs\django\lib\site-packages\django\dispatch\dispatcher.py", line 175, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\__init__.py", line 57, in close_old_connections
    conn.close_if_unusable_or_obsolete()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\backends\base\base.py", line 514, in close_if_unusable_or_obsolete
    self.close()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\backends\sqlite3\base.py", line 248, in close
    if not self.is_in_memory_db():
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\backends\sqlite3\base.py", line 367, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "D:\Anaconda3\envs\django\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
[27/Dec/2022 07:40:02] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49376)
Traceback (most recent call last):
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 196, in finish_response
    self.close()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
    super().close()
  File "D:\Anaconda3\envs\django\lib\wsgiref\simple_server.py", line 38, in close
    SimpleHandler.close(self)
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 334, in close
    self.result.close()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\http\response.py", line 252, in close
    signals.request_finished.send(sender=self._handler_class)
  File "D:\Anaconda3\envs\django\lib\site-packages\django\dispatch\dispatcher.py", line 175, in send
    for receiver in self._live_receivers(sender)
  File "D:\Anaconda3\envs\django\lib\site-packages\django\dispatch\dispatcher.py", line 175, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\__init__.py", line 57, in close_old_connections
    conn.close_if_unusable_or_obsolete()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\backends\base\base.py", line 514, in close_if_unusable_or_obsolete
    self.close()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\backends\sqlite3\base.py", line 248, in close
    if not self.is_in_memory_db():
  File "D:\Anaconda3\envs\django\lib\site-packages\django\db\backends\sqlite3\base.py", line 367, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "D:\Anaconda3\envs\django\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 "D:\Anaconda3\envs\django\lib\socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "D:\Anaconda3\envs\django\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "D:\Anaconda3\envs\django\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\core\servers\basehttp.py", line 169, in handle
    self.handle_one_request()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
    handler.run(self.server.get_app())
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 145, in run
    self.handle_error()
  File "D:\Anaconda3\envs\django\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
    super().handle_error()
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 381, in handle_error
    self.finish_response()
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 184, in finish_response
    self.write(data)
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 287, in write
    self.send_headers()
  File "D:\Anaconda3\envs\django\lib\wsgiref\handlers.py", line 344, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "D:\Anaconda3\envs\django\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
----------------------------------------

 

解决办法:

用str 包裹住,修改前

 用str 包裹住,修改后

 

 重启服务后

 还有一个问题是 第一次装按教程装了一套django环境,在 http://127.0.0.1:8000/docs/报错,然后进行降低django==2.2.0 还是没解决,然后进行删除电脑上下载的python(电脑上有两个python环境,一个从Windows应用商店下载的,已个Anaconda环境,朋友进行了卸载,保留Anaoconda,最后按照https://blog.csdn.net/Rebacca122222/article/details/12528528Anaconda上部署Django环境,服务起不来会报错,卸载了markdown,服务正常起来了

 在 http://127.0.0.1:8000/docs/报错如下

 

  • 9
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值