开发者

Rails or Pylons -- Any good framework for Python?

I have no background in web applications, but have a fairly experience background in C++, and a quick learner.

I have spent some time learning Python and reading through SQLAlchemy. I kind of like the idea of coding in pure Python OO, and then use a nice SQLAlchemy mapper to persist everything. I like this decoupled approach (using pure开发者_如何学编程 Python classes along a mapper function to talk to DB) better than the ActiveRecord idea of Rails. I think eventually I would have more control over connecting the DB to the app. (I need to work with a DB that is updated by a background process. Something like a web crawler that fills the DB.)

At the same time, some stuff makes me think again about Rails. Like streamlined Email and Ajax handling in Rails.

Am I thinking the right way, that Rails is less flexible for Form Validation Manipulations, and working with DB? And is it harder in Pylons to handle Email (notifications), RSS, Ajax?

What would you suggest? Thanks


Have a look at Django. It sounds like this exactely what you are looking for :-).


Have a look at these Python frameworks:

  1. Django: Probably the single most popular Python framework, but for better (and worse) is very-much a full-stack solution.

  2. Pylons: As reaction to the Django One Way of working, Pylons, for better (and worse), uses a much looser binding of the modules that make up your framework.

  3. TurboGears: As an attempt at a happy medium between Django and Pylons, TurboGears is based on Pylons, but comes ready made with certain component choices, and the glue to hold it together.

  4. Zope: Zope is more of an application server and framework than a "web framework". It just happens to be web based.

The first three are all inspired by Ruby on Rails, but each has it's own ideas for improvement. Zope predates Rails, and is it's own world.

I've used TurboGears to develop a few small apps. Kinda nice. At the time, their docs were kinda bad. I hope that's changed.

I've also directly used Python Paste a few times. Paste is the HTTP server base upon which Pylons, and in turn TurboGears, is based. Again very nice.

Also: When given the choice, I've always used SQLAlchemy as an ORM. It's truly an impressive piece of software that I've used for even non-web projects.

Hope this helps. Let us know what path you take. :-)


Rails is written in Ruby, not Python. If you have your heart set on Python, then go with Django. But please give Rails a fair shake; ActiveRecord is not the only ORM available either. I use DataMapper for some apps too. I may be biased, but I'm inclined to think the Rails ecosystem is bigger than that of Django too.


If you are looking for a project similar to rails, you should check out Masonite, A modern and developer-centric web framework in Python


You should also checkout web2py instead of Django. Just an alternative you might consider.

Here's two "A vs. B" articles and discussions regarding the two:

  1. Django vs. web2py
  2. Reddit.com community discussion


I wrote a few websites in Pylons over the years and I like it a lot. The great things about Pylons is that it consists mostly of third party libraries. That means that you're learning many useful libraries that can be used in you other projects, for example SQLAlchemy, WebOb, FormEncode, Beaker, Mako and so on ... Especially SQLAlchemy and Beaker are extremely useful in pretty much any context.


You could also have a look to Nagare, another full stack framework. Some of Nagare based projects already in production can be found on the Nagare web site.


I used Web2Py for many small projects, including many goodies such as the "Workers" & Scheduler concepts, some event-driven updates in web page through the short tornado example in websocket_messaging.py. If you're looking for a small but powerful development framework that includes a small DB and display tables, it's just amazing. You even do not need to write a single HTML line. I do not see any competitor in this area. In my opinion it's far easier and faster than django, but django might provide much freedom in complex apps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜