您是否需要一个框架来为Web编写Ruby或Python代码? [英] Do you need a framework to write Ruby or Python code for the web?

查看:79
本文介绍了您是否需要一个框架来为Web编写Ruby或Python代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我看到在Web开发环境中讨论Ruby或Python时,总是有一个框架(Ruby的Rails,Python的Django).这些框架是否必要?如果不是这样,是否有理由为什么在框架中经常使用这些语言,而在Perl和PHP中却没有?

解决方案

简短的回答是否,不是必须的".在ruby中,您可以使用.erb模板,这些模板的使用方式与使用PHP页面的方式类似.您可以使用多种技术(类似于Rails的框架,Templates甚至直接与HTTP库对话并构建CGI风格的页面)以ruby或Python编写网站.

诸如Python的Django或Ruby的Rails(有很多)之类的Web框架只是提高了PHP或ASP的抽象水平,并使多个过程(例如登录,数据库交互,REST API)自动化,这总是一件好事. /p>

Every time I see Ruby or Python discussed in the context of web development, it's always with a framework (Rails for Ruby, Django for Python). Are these frameworks necessary? If not, is there a reason why these languages are often used within a framework, while Perl and PHP are not?

解决方案

The short answer is no, they are not necessary. In ruby you have .erb templates that can be used in a similar way as you use PHP pages. You can write a site in ruby or Python using several technologies (Rails-like frameworks, Templates or even talking directly with the HTTP library and building the page CGI-style).

Web frameworks like Python's Django or Ruby's Rails (there are many) just raise the level of abstraction from the PHP's or ASP's, and automate several process (like login, database interaction, REST API's) which is always a good thing.

这篇关于您是否需要一个框架来为Web编写Ruby或Python代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆