11

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.

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?

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

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.

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

Advice?

lovesh
  • 5,235
  • 9
  • 62
  • 93
  • Django main sex appeal is the admin app, it is not really useful for non-relational databases. Consider also Flask. – Paulo Scardine Nov 01 '12 at 22:19
  • 1
    What exactly do you want to build ? It would be silly to choose a framework only because of your intended datastore, when there could be other more important factors. – Jonathan Vanasco Nov 01 '12 at 22:58
  • I'd you're not going to use the ORM or the template engine, you shouldn't use Django. Flask does sound like a great alternative. – Thomas Orozco Nov 01 '12 at 23:44
  • @JonathanVanasco I dont take much input from the user so form processing is not a big need – lovesh Nov 02 '12 at 06:06
  • 1
    Can you describe other things? Django gives you lots of "magic" - admin & orm & routes & behind the scenes stuff that are automatically generated. IMO, that's great for certain projects and a nightmare for others where you start to 'fight' the framework. Pyramid and Flask are the opposite. You should evaluate the PROs and CONs of each Framework to see which is best for your short-term and long-term application goals. – Jonathan Vanasco Nov 02 '12 at 16:10
  • @JonathanVanasco can you please say a little more or point me to a link about how pyramid and flask are opposite? – lovesh Nov 02 '12 at 18:04
  • they're not the opposite of each other, but of Django. They're both much more low-level. – Jonathan Vanasco Nov 02 '12 at 18:52

3 Answers3

11

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 :

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.
  • I was impressed by the performance benchmarks between Pyramid over other full stack frameworks.
  • The Pylons/Pyramid culture of 100% code coverage and "only pay for what you eat" was appealing to my own development style.

Cons:

  • The community is growing, but still not as mature as Django
  • There's a lot of documentation, but it's not as robust as some of the Django docs out there
  • 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.

Brian Cajes
  • 3,274
  • 3
  • 21
  • 22
  • Have you tried Flask? Because a some people here recommend Flask I read about Flask too. It looks like Pyramid and Flask both follow similar philosophy of plug and play. – lovesh Nov 02 '12 at 21:14
  • 4
    I have not delved beyond a small test app with Flask. My understanding is that micro-frameworks like Flask and Bottle focuses on smaller web apps and becomes unwieldy as the app becomes large and more complicated: http://pyramid.readthedocs.org/en/1.0-branch/designdefense.html#microframeworks-smaller-hello-world . Also, there's a new video with Chris McDonough that goes deeper into the differences between django and pyramid http://youtu.be/eN7h6ZbzMy0 . – Brian Cajes Nov 02 '12 at 21:48
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.

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.

Edwardr
  • 2,906
  • 3
  • 27
  • 30
4

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.

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

bismigalis
  • 171
  • 1
  • 8