将MongoDB用作数据库时使用哪个python web框架(django或django-norel或pyramid)

时间:2022-08-19 17:08:10

I am using MongoDB as my primary(and only till now) database and because of google and the links it provided me i am confused between Django or Pyramid.

我使用MongoDB作为我的主要(并且直到现在)数据库,因为谷歌及其提供的链接我在Django或金字塔之间感到困惑。

I am comfortable with python but never done web development in python(i have done in PHP). Now because i will be using Mongo so i wont use Django ORM will that take away the ease of development people associate with Django?

我对python很满意,但从未在python中进行过Web开发(我已经在PHP中完成了)。现在因为我将使用Mongo所以我不会使用Django ORM会带走人们与Django相关的易用性吗?

I am new to Django(just a few hours) so i am not sure what parts of the framework the ORM affects.

我是Django的新手(只需几个小时),所以我不确定ORM影响框架的哪些部分。

Or should i go with the django fork django-norel with django mongodb engine (they are not actively maintained though) or should i use Pyramid because i plan to use jinja2 as my template layer so that makes 2 parts of django useless to me.

或者我应该使用带有django mongodb引擎的django fork django-norel(虽然它们没有被主动维护)或者我应该使用Pyramid,因为我打算使用jinja2作为我的模板层,这使得django的两部分对我无用。

After removing these batteries from django does it still remain true that it a framework for people with deadlines?

从django中取出这些电池后,它仍然是一个有截止日期的人的框架吗?

Advice?

建议吗?

3 个解决方案

#1


12  

A year or two ago I was also deciding between django and pyramid w/ mongodb to build a high performance web application. I ultimately chose Pyramid :

一两年前,我还在django和金字塔之间决定使用mongodb来构建一个高性能的Web应用程序。我最终选择了金字塔:

Pros:

优点:

  • Pyramid is very light weight for a full stack framework. There is a minmal amount of 'magic' going on under the hood. I was able to wrap my head around all the pieces.
  • 对于完整的堆栈框架,金字塔非常轻。引擎盖下发生了极少量的“魔术”。我能够把头包裹在所有的碎片上。
  • It is not as opinionated as Django. You can plug and play whatever templating engines or databases you need relatively easily.
  • 它不像Django那样自以为是。您可以相对轻松地即插即用所需的模板引擎或数据库。
  • I was impressed by the performance benchmarks between Pyramid over other full stack frameworks.
  • Pyramid与其他完整堆栈框架之间的性能基准让我印象深刻。
  • The Pylons/Pyramid culture of 100% code coverage and "only pay for what you eat" was appealing to my own development style.
  • 100%代码覆盖的“Pylons / Pyramid”文化和“只为你吃的东西买单”对我自己的发展风格很有吸引力。

Cons:

缺点:

  • The community is growing, but still not as mature as Django
  • 社区正在增长,但仍然没有Django那么成熟
  • There's a lot of documentation, but it's not as robust as some of the Django docs out there
  • 有很多文档,但它不像一些Django文档那样强大
  • The lack of 'magic' and beginner friendly documentation make for a steeper learning curve.
  • 缺乏“魔术”和初学者友好的文档使得学习曲线更加陡峭。

As for using an ORM with MongoDB; I recommend you try building without one at first. After trying a few mongodb ORMs, I've ended up going back to plain pymongo with Colander or Validictory for validation. Pymongo is already very ORM-like, fast, and flexible. I felt the extra layers of abstraction took away from that flexibility, and caused me to write more code than was needed.

至于在MongoDB中使用ORM;我建议你先尝试不用一个人建造。在尝试了几个mongodb ORM后,我最终回到普通pymongo用Colander或Validictory进行验证。 Pymongo已经非常像ORM,快速,灵活。我觉得额外的抽象层剥夺了这种灵活性,导致我编写了比需要更多的代码。

#2


9  

I'm going to suggest an alternative that has not been mentioned: Flask. Flask has a really great (albeit smaller than Django) community and there are a lot of extensions available for common web-app extensions, in the extensions directory.

我将建议一个尚未提及的替代方案:Flask。 Flask有一个非常棒的(尽管比Django小)社区,并且在扩展目录中有很多可用于常见Web应用扩展的扩展。

There are several MongoDB extensions for Flask, which help to integrate MongoDB into the framework, but I would also highly recommend the mongoengine ORM. One of the people working on mongoengine has release an extension for Flask integration, Flask-MongoEngine.

Flask有几个MongoDB扩展,它有助于将MongoDB集成到框架中,但我也强烈推荐使用mongoengine ORM。其中一名致力于mongoengine的人已经发布了Flask整合扩展,Flask-MongoEngine。

#3


3  

Try it all (Django, Pyramid, Flask), read the docs, and you done. If you will select Django, you will not use some parts of it (orm, formlib), and that is all.

尝试一下(Django,Pyramid,Flask),阅读文档,然后你就完成了。如果你选择Django,你将不会使用它的某些部分(orm,formlib),这就是全部。

ALso see this video: https://www.10gen.com/presentations/mongosf-2011/mongodb-with-python-pylons-pyramid

另见这个视频:https://www.10gen.com/presentations/mongosf-2011/mongodb-with-python-pylons-pyramid

#1


12  

A year or two ago I was also deciding between django and pyramid w/ mongodb to build a high performance web application. I ultimately chose Pyramid :

一两年前,我还在django和金字塔之间决定使用mongodb来构建一个高性能的Web应用程序。我最终选择了金字塔:

Pros:

优点:

  • Pyramid is very light weight for a full stack framework. There is a minmal amount of 'magic' going on under the hood. I was able to wrap my head around all the pieces.
  • 对于完整的堆栈框架,金字塔非常轻。引擎盖下发生了极少量的“魔术”。我能够把头包裹在所有的碎片上。
  • It is not as opinionated as Django. You can plug and play whatever templating engines or databases you need relatively easily.
  • 它不像Django那样自以为是。您可以相对轻松地即插即用所需的模板引擎或数据库。
  • I was impressed by the performance benchmarks between Pyramid over other full stack frameworks.
  • Pyramid与其他完整堆栈框架之间的性能基准让我印象深刻。
  • The Pylons/Pyramid culture of 100% code coverage and "only pay for what you eat" was appealing to my own development style.
  • 100%代码覆盖的“Pylons / Pyramid”文化和“只为你吃的东西买单”对我自己的发展风格很有吸引力。

Cons:

缺点:

  • The community is growing, but still not as mature as Django
  • 社区正在增长,但仍然没有Django那么成熟
  • There's a lot of documentation, but it's not as robust as some of the Django docs out there
  • 有很多文档,但它不像一些Django文档那样强大
  • The lack of 'magic' and beginner friendly documentation make for a steeper learning curve.
  • 缺乏“魔术”和初学者友好的文档使得学习曲线更加陡峭。

As for using an ORM with MongoDB; I recommend you try building without one at first. After trying a few mongodb ORMs, I've ended up going back to plain pymongo with Colander or Validictory for validation. Pymongo is already very ORM-like, fast, and flexible. I felt the extra layers of abstraction took away from that flexibility, and caused me to write more code than was needed.

至于在MongoDB中使用ORM;我建议你先尝试不用一个人建造。在尝试了几个mongodb ORM后,我最终回到普通pymongo用Colander或Validictory进行验证。 Pymongo已经非常像ORM,快速,灵活。我觉得额外的抽象层剥夺了这种灵活性,导致我编写了比需要更多的代码。

#2


9  

I'm going to suggest an alternative that has not been mentioned: Flask. Flask has a really great (albeit smaller than Django) community and there are a lot of extensions available for common web-app extensions, in the extensions directory.

我将建议一个尚未提及的替代方案:Flask。 Flask有一个非常棒的(尽管比Django小)社区,并且在扩展目录中有很多可用于常见Web应用扩展的扩展。

There are several MongoDB extensions for Flask, which help to integrate MongoDB into the framework, but I would also highly recommend the mongoengine ORM. One of the people working on mongoengine has release an extension for Flask integration, Flask-MongoEngine.

Flask有几个MongoDB扩展,它有助于将MongoDB集成到框架中,但我也强烈推荐使用mongoengine ORM。其中一名致力于mongoengine的人已经发布了Flask整合扩展,Flask-MongoEngine。

#3


3  

Try it all (Django, Pyramid, Flask), read the docs, and you done. If you will select Django, you will not use some parts of it (orm, formlib), and that is all.

尝试一下(Django,Pyramid,Flask),阅读文档,然后你就完成了。如果你选择Django,你将不会使用它的某些部分(orm,formlib),这就是全部。

ALso see this video: https://www.10gen.com/presentations/mongosf-2011/mongodb-with-python-pylons-pyramid

另见这个视频:https://www.10gen.com/presentations/mongosf-2011/mongodb-with-python-pylons-pyramid