python Django -vs- Grails -vs-?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/75798/
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-11-03 19:28:47  来源:igfitidea点击:

Django -vs- Grails -vs-?

pythondjangoframeworks

提问by Rob

I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?

我想知道是否有类似 Django 的 Web 应用程序开发的简易性以及良好的部署、调试和其他工具这样的东西?

Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However it's written in Python which means there's little real support in the way of deployment/packaging, debugging, profilers and other tools that make building and maintaining applications much easier.

Django 是一个非常高效的框架,用于构建内容丰富的网站;与那里的一些 Java 怪物相比,我尝试过的最好的和呼吸新鲜空气。然而,它是用 Python 编写的,这意味着在部署/打包、调试、分析器和其他使构建和维护应用程序更容易的工具方面几乎没有真正的支持。

Ruby has similar issues and although I do like Ruby muchbetter than I like Python, I get the impression that Rails is roughly in the same boat at Django when it comes to managing/supporting the app.

Ruby有类似的问题,虽然我喜欢红宝石很多比我更喜欢Python中,我得到的印象是Rails是大致在Django的同一条船上,当涉及到管理/支持的应用程序。

Has anyone here tried both Django and Grails (or other web frameworks) for non-trivial projects? How did they compare?

这里有没有人为非平凡的项目尝试过 Django 和 Grails(或其他 Web 框架)?他们是如何比较的?

回答by hendrixski

You asked for someone who used both Grails and Django. I've done work on both for big projects. Here's my Thoughts:

您要找一个同时使用 Grails 和 Django 的人。我已经为大型项目完成了这两项工作。这是我的想法:

IDE's:Django works really well in Eclipse, Grails works really well in IntelliJ Idea.

IDE 的:Django 在 Eclipse 中运行得非常好,Grails 在 IntelliJ Idea 中运行得非常好。

Debugging:Practically the same (assuming you use IntelliJ for Grails, and Eclipse for Python). Step debugging, inspecting variables, etc... never need a print statement for either. Sometimes django error messages can be useless but Grails error messages are usually pretty lengthy and hard to parse through.

调试:几乎相同(假设您对 Grails 使用 IntelliJ,对 Python 使用 Eclipse)。单步调试、检查变量等……两者都不需要打印语句。有时 django 错误消息可能无用,但 Grails 错误消息通常非常冗长且难以解析。

Time to run a unit test:django: 2 seconds. Grails: 20 seconds (the tests themselves both run in a fraction of a second, it's the part about loading the framework to run them that takes the rest... as you can see, Grails is frustratingly slow to load).

运行单元测试的时间:django:2 秒。Grails:20 秒(测试本身都在几分之一秒内运行,其余部分是关于加载框架以运行它们的部分……正如您所见,Grails 加载速度慢得令人沮丧)。

Deployment:Django: copy & paste one file into an apache config, and to redeploy, just change the code and reload apache. Grails: create a .war file, deploy it on tomcat, rinse and repeat to redeploy.

部署:Django:将一个文件复制并粘贴到 apache 配置中,要重新部署,只需更改代码并重新加载 apache。Grails:创建一个 .war 文件,将其部署在 tomcat 上,冲洗并重复以重新部署。

Programming languages:Groovy is TOTALLY awesome. I love it, more so than Python. But I certainly have no complaints.

编程语言:Groovy 非常棒。我喜欢它,比 Python 更喜欢它。但我当然没有怨言。

Plugins:Grails: lots of broken plugins (and can use every java lib ever). Django: a few stable plugins, but enough to do most of what you need.

插件:Grails:许多损坏的插件(并且可以使用每个 Java 库)。Django:一些稳定的插件,但足以满足您的大部分需求。

Database:Django: schema migrations using South, and generally intuitive relations. Grails: no schema migrations, and by default it deletes the database on startup... WTF

数据库:Django:使用 South 的模式迁移,以及通常的直观关系。Grails:没有模式迁移,默认情况下它会在启动时删除数据库...... WTF

Usage:Django: startups (especially in the Gov 2.0 space), independent web dev shops. Grails: enterprise

用途:Django:初创公司(尤其是在 Gov 2.0 领域)、独立的网络开发商店。Grails:企业

Hope that helps!

希望有帮助!

回答by Rob

Grails.

圣杯。

Grails just looks like Rails (Ruby),but it uses groovy which is simpler than java. It uses java technology and you can use any java lib without any trouble.

Grails 看起来很像 Rails (Ruby),但它使用了比 java 更简单的 groovy。它使用 Java 技术,您可以毫无困难地使用任何 Java 库。

I also choose Grails over simplicity and there are lots of java lib (such as jasper report, jawr etc) and I am glad that now they join with SpringSource which makes their base solid.

我也选择 Grails 而不是简单,并且有很多 java lib(例如 jasper report、jawr 等),我很高兴现在他们加入了 SpringSource,这使他们的基础稳固。

回答by zuber

However it's written in Python which means there's little real support in the way of deployment/packaging, debugging, profilers and other tools that make building and maintaining applications much easier.

然而,它是用 Python 编写的,这意味着在部署/打包、调试、分析器和其他使构建和维护应用程序更容易的工具方面几乎没有真正的支持。

Python has:

Python有:

  1. a great interactive debugger, which makes very good use of Python REPL.
  2. easy_installanv virtualenvfor dependency management, packaging and deployment.
  3. profiling featurescomparable to other languages
  1. 一个很棒的交互式调试器,它很好地利用了 Python REPL
  2. easy_installanv virtualenv用于依赖项管理、打包和部署。
  3. 可与其他语言相媲美的分析功能

So IMHO you shouldn't worry about this things, use Python and Django and live happily :-)

所以恕我直言,你不应该担心这些事情,使用 Python 和 Django 并快乐地生活:-)

Lucky for you, newest version of Django runs on Jython, so you don't need to leave your whole Java ecosystem behind.

幸运的是,最新版本的Django 运行在 Jython 上,因此您无需将整个 Java 生态系统抛在脑后。

Speaking of frameworks, I evaluated this year:

说到框架,我今年评估了:

  1. Pylons(Python)
  2. webpy(Python)
  3. Symfony(PHP)
  4. CakePHP(PHP)
  1. 塔架(Python)
  2. webpy(Python)
  3. Symfony(PHP)
  4. 蛋糕PHP (PHP)

None of this frameworks comes close to the power of Django or Ruby on Rails. Based on my collegue opinion I could recommend you kohanaframework. The downside is, it's written in PHP and, as far as I know, PHP doesn't have superb tools for debugging, profiling and packaging of apps.

这些框架都没有 Django 或 Ruby on Rails 的强大功能。根据我同事的意见,我可以向您推荐kohana框架。缺点是,它是用 PHP 编写的,据我所知,PHP 没有用于调试、分析和打包应用程序的出色工具。

Edit:Here is a very good article about packaging and deployment of Python apps(specifically Django apps). It's a hot topic in Django community now.

编辑:这是一篇关于 Python 应用程序(特别是 Django 应用程序)的打包和部署的非常好的文章。现在是 Django 社区的热门话题。

回答by Brian Hibbert

The statement that grails deletes the database on start-upis completely wrong. It's behavior on start-up is completely configurable and easy to configure. I generally use create-drop when running an app in dev mode. I use update when I run in test and production.

grails 在启动时删除数据库的说法是完全错误的。它在启动时的行为是完全可配置且易于配置的。在开发模式下运行应用程序时,我通常使用 create-drop。我在测试和生产中运行时使用更新。

I also love the bootstrap processing that lets me pre-configure test users, data, etc by environment in Grails.

我也喜欢引导程序处理,它让我可以在 Grails 中按环境预先配置测试用户、数据等。

I'd love to see someone who has really built and deployed some commercial projects comment on the pros / cons. Be a really interesting read.

我很想看到真正构建和部署了一些商业项目的人对优点/缺点发表评论。是一个非常有趣的阅读。

回答by Christopher Cashell

I have two friends who originally started writing an application using Ruby on Rails, but ran into a number of issues and limitations. After about 8 weeks of working on it, they decided to investigate other alternatives.

我有两个朋友最初开始使用 Ruby on Rails 编写应用程序,但遇到了许多问题和限制。经过大约 8 周的研究,他们决定研究其他替代方案。

They settled on the Catalyst Framework, and Perl. That was about 4 months ago now, and they've repeatedly talked about how much better the application is going, and how much more flexibility they have.

他们选择了Catalyst Framework和 Perl。那是大约 4 个月前的事了,他们反复谈论应用程序的运行情况有多好,以及他们有多少灵活性。

With Perl, you have all of CPAN available to you, along with the large quantity of tools included. I'd suggest taking a look at it, at least.

使用 Perl,您可以使用所有 CPAN 以及包含的大量工具。我建议至少看看它。

回答by S.Lott

The "good deployment" issue -- for Python -- doesn't have the Deep Significance that it has for Java.

“良好部署”问题——对于 Python——没有它对于 Java 的深刻意义。

Python deployment for Django is basically "move the files". You can run straight out of the subversion trunk directory if you want to.

Django 的 Python 部署基本上是“移动文件”。如果你愿意,你可以直接运行 subversion 主干目录。

You can, without breaking much of a sweat, using the Python distutilsand build yourself a distribution kit that puts your Django apps into Python's site-packages. I'm not a big fan of it, but it's really easy to do.

您可以毫不费力地使用 Python distutils并构建自己的分发工具包,将您的 Django 应用程序放入 Python 的站点包中。我不是它的忠实粉丝,但它真的很容易做到。

Since my stuff runs in Linux, I have simple "install.py" scripts that move stuff out of the Subversion directories into /opt/thisand /opt/thatdirectories. I use an explicit path settings in my Apache configuration to name those directories where the applications live.

由于我的东西在 Linux 上运行,我有简单的“install.py”脚本,可以将 Subversion 目录中的东西移到/opt/this/opt/that目录中。我在 Apache 配置中使用显式路径设置来命名应用程序所在的目录。

Patching can be done by editing the files in place. (A bad policy.) I prefer to edit in the SVN location and rerun my little install to be sure I actually have all the files under control.

可以通过就地编辑文件来完成修补。(不好的策略。)我更喜欢在 SVN 位置进行编辑,然后重新运行我的小安装,以确保我确实控制了所有文件。

回答by Trausti Thor

cakephp.org

cakephp.org

Cakephp is really good, really close to ruby on rails (1.2). It is in php, works very well on shared hosts and is easy to implement.

Cakephp 非常好,非常接近 ruby​​ on rails (1.2)。它在 php 中,在共享主机上运行良好,并且易于实现。

The only downside is that the documentation is somewhat lacking, but you quickly get it and quickly start doing cool stuff.

唯一的缺点是文档有点缺乏,但你很快就会得到它并很快开始做很酷的事情。

I totally recommend cakephp.

我完全推荐cakephp。

回答by zgoda

Personally I made some rather big projects with Django, but I can compare only with said "montrosities" (Spring, EJB) and really low-level stuff like Twisted.

就我个人而言,我用 Django 做了一些相当大的项目,但我只能与所说的“montrosities”(Spring、EJB)和像 Twisted 这样非常低级的东西进行比较。

Web frameworks using interpreted languages are mostly in its infancy and all of them (actively maintained, that is) are getting better with every day.

使用解释语言的 Web 框架大多处于起步阶段,所有这些(即积极维护)每天都在变得更好。

回答by Powerlord

By "good deployment" are you comparing it with Java's EAR files, which allow you to deploy web applications by uploading a single file to a J2EE server? (And, to a lesser extent, WAR files; EAR files can have WAR files for dependent projects)

通过“良好的部署”,您是将它与 Java 的 EAR 文件进行比较,后者允许您通过将单个文件上传到 J2EE 服务器来部署 Web 应用程序?(并且,在较小程度上,WAR 文件;EAR 文件可以包含相关项目的 WAR 文件)

I don't think Django or Rails have gotten quite to that point yet, but I could be wrong... zuber pointed out an article with more details on the Python side.

我认为 Django 或 Rails 还没有达到那个程度,但我可能是错的……zuber 指出了一篇关于 Python 方面更多细节的文章。

Capistranomay help out on the Ruby side.

Capistrano可能会在 Ruby 方面有所帮助。

Unfortunately, I haven't really worked with either Python or Ruby that much, so I can't help out on profilers or debuggers.

不幸的是,我并没有真正使用过 Python 或 Ruby,所以我无法在分析器或调试器方面提供帮助。