用于 Web 开发的 Python 或 Ruby?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2011843/
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
Python or Ruby for web development?
提问by eozzy
I'm a web developer proficient in HTML, CSS and Javascript, but to be able to develop my own web applications, I'd like to learn a programming language besides PHP.
我是一名精通 HTML、CSS 和 Javascript 的 Web 开发人员,但为了能够开发自己的 Web 应用程序,我想学习 PHP 之外的编程语言。
I've been learning Python for a while now but it seems a general purpose language, a bit complex, and not suited for web-development I guess.
我已经学习 Python 一段时间了,但它似乎是一种通用语言,有点复杂,我猜不适合 Web 开发。
So if my focus is creating webapplications ONLY, which should I learn: Python or Ruby?
因此,如果我的重点只是创建Web应用程序,我应该学习哪个:Python 还是 Ruby?
Many thanks for your comments and advices.
非常感谢您的意见和建议。
回答by JRL
One idea would be to try both!
一个想法是尝试两者!
Test writing a simple blog page with both, and choose whichever you like best.
测试使用两者编写一个简单的博客页面,然后选择您最喜欢的那个。
回答by codeape
I've been learning Python for a while now but it seems a general purpose language, a bit complex, and not suited for web-development I guess.
我已经学习 Python 一段时间了,但它似乎是一种通用语言,有点复杂,我猜不适合 Web 开发。
Python is very well suited for web development. There are a number of web frameworks available, like Djangoand Flask(others include TurboGears, Pylons, web.py, web2py, ...).
Python 非常适合 Web 开发。有许多可用的 Web 框架,例如Django和Flask(其他包括 TurboGears、Pylons、web.py、web2py 等)。
I guess your question has no real answer. Python programmers will say go with Python, Ruby programmers will say go with Ruby. As @JRL says, try both. I suggest you spend some time evaluating RoR and Django (go through tutorials, for instance).
我想你的问题没有真正的答案。Python 程序员会说使用 Python,Ruby 程序员会说使用 Ruby。正如@JRL 所说,两者都尝试。我建议您花一些时间评估 RoR 和 Django(例如,通过教程)。
回答by Fang-Pen Lin
Python definitely can be used in web development. There are so many web sites are written in Python. For example:
Python绝对可以用于Web开发。有很多网站是用 Python 编写的。例如:
- http://youtube.com
- http://plurk.com
- http://sourceforge.com(see Sourceforge on TurboGears2: http://compoundthinking.com/blog/index.php/2009/07/16/turbogears-on-sourceforge/)
- http://www.reddit.com/
- http://youtube.com
- http://plurk.com
- http://sourceforge.com(参见关于 TurboGears2 的 Sourceforge:http: //compoundthinking.com/blog/index.php/2009/07/16/turbogears-on-sourceforge/)
- http://www.reddit.com/
and so on..
等等..
Also, there is so many great python web frameworks.
此外,还有很多很棒的 Python Web 框架。
- TurboGears
- Django
- Pylons
- Web2py
- 涡轮齿轮
- 姜戈
- 塔架
- 网络2py
I have wrote some web-applications in asp, perl and php before. And finally I wrote web-applications in Python. It is the best language for web development I have never seen.
我以前用 asp、perl 和 php 写过一些 web 应用程序。最后我用 Python 编写了 Web 应用程序。它是我从未见过的最好的 Web 开发语言。
回答by kibitzer
If you plan to quickly build web applications, you can choose between Django (python) or RoR (ruby), they have similar functionality with Django being stricter but it mostly depends on your language preference.
如果您打算快速构建 Web 应用程序,您可以在 Django (python) 或 RoR (ruby) 之间进行选择,它们具有类似的功能,但 Django 更严格,但这主要取决于您的语言偏好。
But, talking from experience, if you would need to support that web application later, then Django is a preferred choice - it has much less magic than RoR going on, and it is much easier to figure out and fix bugs in after some time has passed - or if you are not the original developer.
但是,根据经验,如果您以后需要支持该 Web 应用程序,那么 Django 是首选 - 它比 RoR 的魔力少得多,并且在一段时间后更容易找出并修复错误通过 - 或者如果您不是原始开发人员。
回答by Dean
RubyOnRailsmight be a better fit for Web Only development but the languages themselves are both General Purpose languages without a web framework.
RubyOnRails可能更适合 Web Only 开发,但这些语言本身都是没有 Web 框架的通用语言。
回答by Andrew McGregor
If you haven't looked into the libraries situation, you'll get exactly the same impression of Ruby as you do of Python: they both aregeneral purpose languages, until you add a framework. For example, with Python that could be Django, whereas for Ruby it would most likely be Rails. Those aren't the only choices for either language, but you can't evaluate the languages without also evaluating the frameworks.
如果您没有研究过库的情况,您对 Ruby 的印象与对 Python 的印象完全相同:它们都是通用语言,直到您添加框架为止。例如,Python 可能是 Django,而 Ruby 最有可能是 Rails。这些不是两种语言的唯一选择,但如果不评估框架,就无法评估语言。