Pymongo失败,错误' sys'未定义
我有一个django应用程序,可以查询mongoDB。
unignts.txt
:
# other dependencies
pymongo==4.1.0
查看:
client = pymongo.MongoClient("mongodb+srv://*****@****.mongodb.net/test_db?retryWrites=true&w=majority")
执行此行时,django服务器会引发以下错误:
venv/lib/python3.9/site-packages/pymongo/uri_parser.py, line 467, in parse_uri
Exception: name 'sys' is not defined
我如何修复此错误?我在Python3.9和最新的Django上。
I have a Django app that queries mongodb.
requirements.txt
:
# other dependencies
pymongo==4.1.0
View:
client = pymongo.MongoClient("mongodb+srv://*****@****.mongodb.net/test_db?retryWrites=true&w=majority")
When this line is executed, the Django server throws the following error:
venv/lib/python3.9/site-packages/pymongo/uri_parser.py, line 467, in parse_uri
Exception: name 'sys' is not defined
How do I fix this error? I'm on Python3.9 and latest Django.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
支持 mongodb+srv:// uris需要
”
PIP安装Pymongo [SRV]
Support for mongodb+srv:// URIs requires dnspython:
use
pip install pymongo[srv]