MongoEngine 与 MongoKit for Django

发布于 2024-09-18 18:30:25 字数 201 浏览 3 评论 0原文

您是否在 Django 中使用过 MongoEngine 或 MongoKit?你更喜欢哪一个?

背景:

我正在开发一个新网站,并且拥有正常 Django 开发经验,但对于我将使用的数据类型,MongoDB 比 SQL 数据库更适合。

我使用的是 Python 2.7,可以在我的主机上编译/安装任何东西,所以这不是问题。

Have you used MongoEngine or MongoKit with Django? Which one do you prefer?

Background:

I'm developing a new site and have experience with normal Django development but for the kind of data I'll be using the MongoDB will be better suited than a SQL database.

I'm using Python 2.7 and can compile/install anything on my host so that's not a problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

匿名。 2024-09-25 18:30:25

mongoengine 在处理模型方面将更像 django。这就是为什么我为我的项目选择它

mongoengine will be more django like in how you handle your models. That is why i choose it for my projects

久夏青 2024-09-25 18:30:25

在我看来,mongoengine 更类似于 mongokit 的 django db 模型风格,但 mongokit 更多地代表了原始 mongodb 模型的风格和布局。 MongoKit +1

如果您能够在这两个库之外进行选择,那么我会选择 django-mongodb -engine 因为它是专门为 django 和管理界面构建的。

In my eyes mongoengine is more simular to django db model style as mongokit but mongokit represent more the style and layout of your raw mongodb model. +1 for MongoKit

If you able to choice beside this two libs than I would take django-mongodb-engine because it is special builded for django and the admin interface.

飘落散花 2024-09-25 18:30:25

TL;DR:MongoEngine!

我很高兴多次使用 MongoKit 和 MongoEngine 处理复杂的项目。

我将从最后开始:GitHub 上的 MongoKit 项目已经死了。在选择正确的工具时,请始终记住,使用维护良好的项目会带来巨大的差异。功能更多,错误更少,并且总有人帮助您解决问题。

如果您使用 MongoKit 做非常简单的事情,那就没问题了。但当使用更多的功能时,我发现了越来越多的bug。其实我也提交了修复,但是没有人接受。另一方面,MongoEngine 社区非常专业且活跃。

在习惯了 MongoEngine 语法之后,我喜欢它的每一点:)

TL;DR: MongoEngine!

I've had the pleasure to work many times both with MongoKit and MongoEngine on complex projects.

I'll start from the end: MongoKit project on GitHub is dead. When choosing the right tool, always remember that working with well maintained project is a huge difference. There are more features, less bugs and always someone to help you with problems.

If you do very simple stuff with MongoKit you'll be fine. But when using more features, I found more and more bugs. Actually I also submitted fixes and there were no one to accept them. On the other hand, MongoEngine community is super professional and a live.

After getting used to MongoEngine syntax I enjoy every bit of it :)

中二柚 2024-09-25 18:30:25

你说你有经验

正常的Django开发

那么为什么不继续使用通常的 Django ORM 并使用 连接器< /a>?

Djongo:策略是将 Django ORM 生成的 Django SQL 查询语法转换为 pymongo 命令。 Djongo 将每个 SQL 查询字符串转换为 mongoDB 查询文档。

如果您想使用 Django Admin 操作 MongoDB,请启动它:

manage.py runserver

转到: http://localhost:8000/admin/

操作您的 MongoDB 嵌入式模型,如以下屏幕截图所示:

在此处输入图像描述

有一篇关于仅添加一行代码即可将 Django 与 MongoDB 结合使用 ,如果您正在寻找更多信息。否则,您可以直接跳到 djongo 文档并开始使用它。

You say you have experience with

normal Django development

Then why don't you continue to use the usual Django ORM and connect it to MongoDB using a connector?

Djongo: The strategy is to translate Django SQL query syntax generated by the Django ORM into pymongo commands. Djongo translates every SQL query string into a mongoDB query document.

If you want to manipulate MongoDB using Django Admin, fire it up:

manage.py runserver

Goto: http://localhost:8000/admin/

Manipulate your MongoDB embedded models as shown in this screenshot:

enter image description here

There is an article on Using Django with MongoDB by adding just one line of code, if you are looking for more information. Otherwise, you can jump directly into the djongo documentation and start using it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文