Python Web 框架与 Java Web 框架(Python 中的 Web 开发是如何完成的?)

发布于 2024-10-15 19:20:22 字数 505 浏览 4 评论 0原文

我正在考虑启动一个个人宠物网络项目来尝试不同的事物并扩展我的知识。

我在工作中经常使用 Java(用于 Web 应用程序:D),并且正在考虑用 Python 来创建自己的语言,因为我有点喜欢这种语言,但从未通过简单的脚本阶段。

我想进一步了解 Python(使用 2.6.5),但不知道会发生什么或选择什么框架:Django、Pylons、web2py 等。

我也不知道这些框架将为我提供多少帮助以及我需要从头开始写多少内容。

如果有人可以提供给我,我可以使用与 Java 的比较。我正在考虑过滤器功能,例如 sitemesh、自定义标签(例如 JSTL);在 Python 中,我可以编写带有标签的干净 HTML 页面,还是编写大量打印语句(类似于 Java 中的 servlet 等)?

我不知道如何确切地表达这个问题。

我实际上需要一个关于 web 的演示开发是用 Python 进行的,处于什么级别,Web 框架可以带来什么?

您能分享一下您的

TIA经验吗?

I am thinking in starting a personal pet web project to experiment with different things and extend my knowledge.

I use Java a lot at work (for web applications :D) and was thinking in making my own in Python since I kinda like this language but never passed the simple scripts stages.

I want to step up a gear regarding Python (using 2.6.5) and don't know what to expect or what framework to choose from: Django, Pylons, web2py etc.

I also don't know how much these frameworks will offer me and how much will I have to write from scratch.

I could use a comparison with Java if somebody can provide me with. I'm thinking at filter functionalities such as sitemesh, custom tags like JSTL; In Python, can I write clean pages of HTML with tags in them or write a lot of print statements (something like servlets did in Java etc?

I don't know exactly how to phrase this question.

I actually need a presentation of how web development is performed in Python, at what level, and what the web frameworks bring to the table.

Can you share from your experience?

TIA!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

假面具 2024-10-22 19:20:22

你好,尝试一下 Bottle Python 框架(bottle.paws.de / Bottlepy.org),使用起来非常快,而且不会妨碍你,而且它最好的一点是它只需要导入一个文件,我最近从 PHP 迁移过来,我必须告诉你我非常...喜欢它!

hi try bottle python framework (bottle.paws.de / bottlepy.org) its really nice to use blistering fast and gets out of your way + the best thing about it is that its one single file to import, i recently migrated from PHP and i have to tell you am so ... loving it!

揽清风入怀 2024-10-22 19:20:22

Python Web 框架 运行全部功能/设施,从 WSGI 周围的垫片开始,例如Bottle 和 Flask,一直到 Django 和 TurboGears 等完整框架,甚至 Zope 等“大型框架”。每个人所做的事情都略有不同,但每个人都会有一些熟悉感。

Python web frameworks run the full gamut of capabilities/facilities, all the way from shims around WSGI such as Bottle and Flask, all the way to full frameworks such as Django and TurboGears, and even "megaframeworks" such as Zope. Each does things slightly differently, but there will be some familiarity from one to the next.

风为裳 2024-10-22 19:20:22

这可能听起来很奇怪,但无需了解“如何在 Python 中执行 Web 开发”即可开始执行此操作。
事实上,使用语言/框架等是理解它的最可靠的方法。您不会从一页摘要中获得太多收获。

而且,将它与 Java 进行比较也没有什么帮助。进行“Python 中的 Java 风格开发”是没有意义的。如果你想受益,你需要理清思路并以“Python 方式”做所有事情。

至于选择什么 Python 框架,Django 似乎是一个很好的起点。它非常受欢迎,这意味着您不会没有教程/文档/帮助。

PS 简短版:就这么做吧。

It may sound strange, but there's no need to know "how web development is performed in Python" to start doing it.
In fact, working with language/framework/etc is a single most reliable way to get understanding of it. You won't gain a lot from one-page summaries.

Also, comparing it with Java isn't likely to help. There's no point in doing "Java-style development in Python". If you want to benefit, you'll need to clear your mind and do everything "Python-way".

As to what Python framework to choose, Django seems like like a good starting point. It's very popular, which means you won't be left without tutorials/documentation/help.

PS Short version: just do it.

梦里兽 2024-10-22 19:20:22

Python Web 框架的实现方式与某些基于 Java 的框架类似。我可以在这里代表 Django 发言。

一个很好的比较是 Play!对阵姜戈。它们都促进使用 MVC 架构(或 MTV = 模型、模板、视图),并且已经为您提供了很多东西,例如管理页面中的 CRUD 操作、ORM、身份验证、URL 配置、模板语言等等。

其他基于 Java 的框架可能有很大不同,我无法给您一个通用的答案。根据选择的不同,只有很少的差异。您只需选择您最喜欢的语言和框架即可。我建议阅读一些教程(Django 教程Play! 框架教程),看看哪一个最适合您的需求。

Python web frameworks do it in a similar way as some Java-based frameworks. I can speak for Django here.

A good comparison could be Play! vs. Django. Both of them foster using an MVC architecture (or MTV = models, templates, views) and already provide you with a lot of things like CRUD operations in admin pages, ORM, authentication, URL configurations, a template language and much more.

Other Java-based frameworks might differ a lot, and I can't give you a general answer. Depending on the choice, there are only few differences. You can simply choose the language and framework you like the most. I'd recommend to go through some tutorials (Django tutorial, Play! framework tutorial for instance) and look which one works best for your needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文