Django, Turbo Gears, Web2Py, which is better for what?

我只是一个虾纸丫 提交于 2019-11-30 01:05:10
mdipierro

You should look at the web2py online documentation (http://web2py.com/book). It comes with a Role Based Access Control (the most general access control mechanism) and it is very granular, you can grant access for specific operation on specific records. It comes with a web based IDE but you can use WingIDE, Eclipse and PyCharm too. It comes with helper system that allows you to generate HTML without using HTML. Here is an example of a complete app that requires users to register/login/post messages:

db.define_table('message',Field('body'),Field('author',db.auth_user))
@auth.requires_login()
def index():
    db.message.author.default=auth.user.id
    db.message.author.writable=False
    return dict(form=crud.create(db.message),
                messages=db(db.message.id>0).select())

The web2py project is very active as you can see from the list of changes http://code.google.com/p/web2py/source/list

If you have web2py related questions I strongly suggest you join the web2py mailing list: http://groups.google.com/group/web2py/topics

We are very active and your questions will be answered very quickly.

I have to say as not particularly skilled developer, the speed at which I have been able to create using web2py has blown my mind. In large part due to the amazing community and the core value Massimo has of making the framework accessible.

When I started I had written 0 lines of code in Python Never heard of web2py

I've been at it seriously for about a month and have progressed (in my usual fashion) from asking questions that no one could answer (because they didn't make any sense) to coding for hours at a time without picking up a book or asking a question.

I'm really impressed.

I've had positive experiences with Django.

  • Built-In Authentication and easy to use extensions for registration
  • Very good documentation
  • You probable write your HTML templates mostly in base.html, then just use template inheritance (Note: You'll need to write at least a little bit of HTML)
  • In contrast to Turbogears, Django is more 'out-of-the-box'
  • I don't have any experience with web2py, but from my impression, it tries to do a little to much 'out-of-the-box'

If you decide to go with Django, make sure that you use its Generic Views. They will save you from writing lots of code, both Python and HTML.

Also, unless there is a very specific reason for you to use MySQL, I advise you to switch to PostgreSQL. Django is much more oriented towards PostgreSQL and it's a much better database anyway.

The online Django documentation is great, this is what put it apart from all the other frameworks. I also recommend the book Practical Django Projects by James Bennett

  • Django: Heard it has the best administrative interface. But uses it's own ORM, i.e. doesn't use SQL-Alchemy.

  • Web2py: Didn't research this.

  • Turbogears2: Uses SQL-Alchemy by default, uses Catwalk for admin interface, but documentation isn't as great.

I chose Turbogears2 because it uses popular components, so I didn't have to learn anything new...

I've used both web2py and RoR extensively, and while RoR has gotten a lot of popularity and support in the past few years, web2py is simpler, cleaner, less "magical", and yet also offers more (useful) out-of-the-box functionality. I'd say that web2py has more potential than RoR, but it is a relatively new framework and does yet not have the maturity of RoR. (Despite that, though, I'd choose web2py over RoR any day...)

If you "don't want to see any HTML while building it" then you can forget Django. It is not focused on "point-click-done," it is focused on pros going from concept to production in the shortest time possible. The hierarchical nature of the templating language can lead to some very clean overall site layouts. I use Django for all of my larger sites and I love it.

Although it's written in PHP, not Python, you might take a look at the major new version of WordPress that came out about 2 or 3 months ago. In 3.0 they have come a long way from being a "blogs only" environment and there are tons of ready-made templates for it. Of course if you want to tweak a template, well, there's that nasty old HTML again. I am considering using it for my smaller clients that can't deal with the admin of a dedicated server, etc., that tends to come with a Django site.

Update: Ah, I missed the semi-joke -- I was up too early and that tends to make me tone deaf to humor. As far as using templates from existing sites, I have done this quite successfully with a couple of sites, both those that were static and those originally driven by well-written PHP scripts. I recommend a careful reading of the {% extends %} and {% include %} docs. Both take either a string literal or a variable. I have used the later method and it can be quite useful for a site that has strong hierarchy distinguished by style changes across branches.

It is also worth the time to understand the search order for templates -- it can be used to good effect, but it can be puzzling if you don't grok it. See the template-related items in the settings.py file for this and other useful goodies.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!