Python Django vs web2py 适合初学者

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4352428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 15:22:50  来源:igfitidea点击:

Django vs web2py for a beginner developer

pythondjangoweb2py

提问by RubyGladiator

Which of these two frameworks is better suited to a developer with 11 months experience. I have decided to learn python for my server side coding and wanted to know which of these would be better suited for someone at my skill level. I have just spent a few days playing around with web2py and really like it and i am wondering if Django offers something more that i am missing out on?

这两个框架中哪一个更适合具有 11 个月经验的开发人员。我决定为我的服务器端编码学习 python,并想知道哪些更适合我的技能水平的人。我刚刚花了几天时间玩 web2py 并且真的很喜欢它,我想知道 Django 是否提供了更多我错过的东西?

PS. UPDATE: Thank you all for the wonderful input, after buying three django books and going through a few small projects/tutorials for both django and web2py, i have settled on web2py. This is a wonderful framework, which makes web development really fun for a newbe. I would recommend all newbies to learn this framework as it will be mainstream in the future. Django is also a wonderful framework but web2py is just better in my limited experience opinion.

附注。更新:感谢大家的精彩投入,在购买了三本 django 书籍并浏览了 django 和 web2py 的一些小项目/教程后,我已经决定使用 web2py。这是一个很棒的框架,它使 Web 开发对新手来说非常有趣。我会推荐所有新手学习这个框架,因为它将成为未来的主流。Django 也是一个很棒的框架,但在我有限的经验看来,web2py 只是更好。

采纳答案by mdipierro

(disclaimer: I am the project leader for web2py)

(免责声明:我是 web2py 的项目负责人)

Django has been around 5 years longer than web2py therefore it has more users and more applications to show off. Django has what they call "admin" which is not the same as web2py's "admin" but more like web2py's "appadmin". Django's "admin" is better and more customizable than web2py's "appadmin". Django does not have the equivalent of web2py's "admin". (sorry for the name confusion).

Django 比 web2py 长了大约 5 年,因此它有更多的用户和更多的应用程序可以炫耀。Django 有他们所谓的“admin”,这与 web2py 的“admin”不同,但更像是 web2py 的“appadmin”。Django 的“admin”比 web2py 的“appadmin”更好,更可定制。Django 没有相当于 web2py 的“管理员”。(抱歉名称混淆)。

web2py is more compact and has more functionality out of the box (more supported databases, web based IDE, ticketing system, runs on GAE without patches, multiple login methods, role based access control, web based translation interface, support for multiple database connections, distributed transactions, and more).

web2py 更紧凑并且具有更多开箱即用的功能(更多支持的数据库,基于 Web 的 IDE,票务系统,在没有补丁的 GAE 上运行,多种登录方法,基于角色的访问控制,基于 Web 的翻译界面,支持多个数据库连接,分布式事务等)。

For me the most important functionality of web2py is automatic migrations. Django does not provide them out of the box.

对我来说,web2py 最重要的功能是自动迁移。Django 没有提供开箱即用的功能。

For web2py long term backward compatibility is a primary goal, together with security. Django is comparable to web2py in terms of security (except that web2py had CSRF prevention and default escaping in templates before they did) but Django broke backward compatibility when 1.0 was released. web2py never did since Oct 2007.

对于 web2py 长期向后兼容性是一个主要目标,连同安全性。Django 在安全性方面与 web2py 相当(除了 web2py 具有 CSRF 预防和模板中的默认转义之前)但 Django 在 1.0 发布时破坏了向后兼容性。web2py 自 2007 年 10 月以来从未这样做过。

To me the web2py syntax is more natural:

对我来说 web2py 语法更自然:

 db(db.tablename.fieldname <= value).select() # web2py
 Tablename.objects.filter(fieldname__lt=value) # Django

I am not aware of any functionality of web2py that is not present in Django. I have asked that question many times because, if there is, we want to add it to web2py, but I have not yet received a satisfactory answer.

我不知道 Django 中不存在 web2py 的任何功能。这个问题我已经问过很多次了,因为如果有的话,我们想把它添加到 web2py 中,但我还没有得到满意的答复。

Of course there are things that we both do but differently. Django follows "explicit is better than implicit". web2py does not and instead follows "everything should have a default behavior". I believe this makes web2py code and configuration more compact.

当然,有些事情我们都做,但不同。Django 遵循“显式优于隐式”。web2py 没有,而是遵循“一切都应该有一个默认行为”。我相信这会使 web2py 代码和配置更加紧凑。

Anyway, whatever you choose, they are both good solid web frameworks and there are fewer similarities than differences. Django's developers are very smart people.

无论如何,无论您选择什么,它们都是很好的可靠 Web 框架,并且相同点比不同点要少。Django 的开发人员是非常聪明的人。

The web2py community is very friendly. As an experiment, try asking a question on the web2py google group and on the Django group.

web2py 社区非常友好。作为实验,尝试在 web2py google group 和 Django group 上提问。

回答by keybits

Both Django and web2py are excellent 'full stack' web frameworks with similar features and capabilities - you won't be 'missing out' on much as a beginner with either framework.

Django 和 web2py 都是出色的“全栈”Web 框架,具有相似的特性和功能——您不会像初学者一样“错过”任何一个框架。

It's hard to answer your question without knowing more about what you want to do with your learning. Some would say that there is a danger of learning the framework and not the language so it might be best to get a deeper understanding of the Python language and lighter weight frameworks (e.g. Flaskor wekzeug) first.

如果不了解更多关于你想用你的学习做什么,就很难回答你的问题。有人会说,学习框架而不是语言存在危险,因此最好先深入了解 Python 语言和轻量级框架(例如Flaskwekzeug)。

Having said that, web2py has a lower initial learning curve than Django as it was specifically designed as a learning tool. So I'd say you've made a good choice. No learning is ever wasted and if you decided you need something else in the future the good techniques you will have learnt using web2py will not go to waste.

话虽如此,web2py 的初始学习曲线比 Django 低,因为它是专门作为学习工具设计的。所以我会说你做出了一个很好的选择。任何学习都不会浪费,如果您决定将来需要其他东西,那么您将使用 web2py 学到的好技术不会浪费。

Although there are more learning resources for Django, as it has been around longer and has more users, learning web2py is also fast because of the excellent bookand almost instant responses to questions on the user group.

虽然django的学习资源比较多,但是因为它存在的时间更长,用户也比较多,所以学习web2py也很快,因为优秀的和对用户群的问题几乎是即时的回答。

If you're looking to get a job, there are more Django jobs so that might be a factor. Having said that, the web2py community has recently set up experts4solutionswhere you could promote your skills and availability in the future.

如果你想找一份工作,有更多的 Django 工作,所以这可能是一个因素。话虽如此,web2py 社区最近设立了Expert4solutions,您可以在其中提升您的技能和未来的可用性。

Have fun!

玩得开心!

回答by saeedgnu

In many words: (as I understood)

用很多话:(据我所知)

Web2py is definitely easier and makes the code simpler and cleaner. But Django gives you a better understanding on whats going on, and also more power to modify the design/process.

Web2py 绝对更简单,并使代码更简单、更清晰。但是 Django 可以让您更好地了解正在发生的事情,并且可以更强大地修改设计/流程。

Web2py has more focus on "simple is better than complex", but Django has more focus on "explicit is better than implicit". Two parts of The Zen of Python, so its very hard to say which framework is more Pythonic.

Web2py 更关注“简单优于复杂”,而 Django 更关注“显式优于隐式”。Python 之禅的两部分,所以很难说哪个框架更 Pythonic。

回答by user595985

I'm a complete noob with both Web2py and DJango, but I wanted a web framework that was pythonic to play with,learn and create a front end for a simple database. I looked at web2py but couldn't find any decent tutorials,targeted at complete newbies, when i did get web2py installed, which was very easy, i didn't know what to do next, there seemed to be no tutorials that guided me on how to build a simple web app,(not just hello world). On the other hand DJango did Writing your first DJango App Part 1. This has been really good, giving a newbie an introduction on how to setup & use the framework by writing a simple web app. Until Web2Py offers this, my vote goes to DJango.

我是 Web2py 和 DJango 的完全菜鸟,但我想要一个 Pythonic 的 web 框架来玩,学习和创建一个简单数据库的前端。我看了 web2py 但找不到任何像样的教程,针对完全新手,当我确实安装了 web2py 时,这很容易,我不知道下一步该怎么做,似乎没有教程指导我如何构建一个简单的 Web 应用程序,(不仅仅是 hello world)。另一方面,DJango 确实编写了您的第一个 DJango 应用程序第 1 部分。这真的很好,通过编写一个简单的 Web 应用程序,向新手介绍了如何设置和使用该框架。在 Web2Py 提供此功能之前,我的投票投给了 DJango。