suchen
HeimBackend-EntwicklungPython-Tutorial微框架 Python Flask 和 Ruby Sinatra,哪个更值得推荐?

说到微框架,Python Flask和Ruby Sinatra无疑是最热门的两个了,想听听有接触过的朋友对这两个的评价以及推荐建议。从我目前的了解,Python虽然在国内的发展貌似好于Ruby,但是在国外的Web开发方便,Ruby的Rails/Sinatra基本上都占据着主导的位置,从Google出来的资料便可略知一二。

回复内容:

这个问题很难回答,Sinatra vs Flask的最主要差别,其实是Ruby和Python的差别。当然Flask要比Sinatra重一些,社区更完善,文档更多,扩展性更强。Sinatra本身如果要应用在中型以上的项目,要自己做很多boilerplate,当然你也可以用基于Sinatra并且整合了许多东西的Padrino。

对于这种micro framework,他们绝大多数的设计哲学都很像,其中的差别主要是语言本质的差别。当然,要开发一个稍微有一点规模的东西,是需要引入大量的third party libraries的,尤其是ORM。Python的ORM主要是SQL Alchemy,而Ruby用的比较多的事ActiveRecord和DataMapper。

最后,我对“在国外的Web开发方便,Ruby的Rails/Sinatra基本上都占据着主导的位置”并不认同。Ruby/Rails社区在Web方面很有创造力,有许多很不错的idea,而Python社区则相对安静。但是对于产出来说,Python并不比Ruby弱。Jeff Atwood写过一篇文章,提到“Ruby is not cool anymore”,所以你看到Ruby社区似乎很“活跃”,其实是因为Ruby/Rails流行的比较晚,所以有许多空白要填补,也有许多新轮子由于语言特性而被造出来——Python很早已经过了这个时代。在过了“being cool”的时代过后,将会迎来“get shit done”的时代。 这问题和 Python VS. Ruby 没什么不同。。。

问题是何必 VS 呢,训练有素的工程师在这两个框架下写点东西用不了 30 分钟的时间。花个周末连 node 的框架也一起玩玩,喜欢什么自然有判断。 web编程最花时间的是模板和DB,模板各家都差不多,DB的orm 库,python里面只有django做的最好,但是无法独立使用,Sinatra 可以用ActiveRecord。所以,不考虑学习成本的情况下,干活用Sinatra更好 1 - 我用Sinatra三年了, 说它简单, 其实只是用起来简单。 学起来, 对它深入了解, 优化, 就不容易了,

2 - 实质性的, Sinatra就是Rack, RoR也是Rack, 好比不同的linux发行版一样。


文档和源码 sinatra/sinatra · GitHub python vs ruby. 点在于python坑少
Stellungnahme
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Python: Ein tiefes Eintauchen in Zusammenstellung und InterpretationPython: Ein tiefes Eintauchen in Zusammenstellung und InterpretationMay 12, 2025 am 12:14 AM

PythonusesahybridmodelofCompilation und Interpretation: 1) thepythonInterPreterCompilessourceCodeIntoplatform-unintenpendentBytecode.2) Thepythonvirtualmachine (PVM) ThenexexexexecthisByTeCode, BalancingeAnsewusewithperformance.

Ist Python eine interpretierte oder eine kompilierte Sprache, und warum ist es wichtig?Ist Python eine interpretierte oder eine kompilierte Sprache, und warum ist es wichtig?May 12, 2025 am 12:09 AM

Pythonisbothinterpreted und kompiliert.1) ItscompiledToByteCodeForPortabilityAcrossplatform.2) thytecodeTheninterpreted, und das ErlaubnisfordyNamictyPingandRapidDevelopment zulässt, obwohl es sich

Für Schleife vs während der Schleife in Python: Schlüsselunterschiede erklärtFür Schleife vs während der Schleife in Python: Schlüsselunterschiede erklärtMay 12, 2025 am 12:08 AM

ForloopsaridealWenyouKnowtHenumberofofiterationssinadvance, während whileloopsarebetterForsituationswhereyouneedtoloopuntilaconditionismet.forloopsaremoreffictionAndable, geeigneter Verfaserungsverlust, whereaswiloopsofofermorcontrolanduseusefulfulf

Für und während Schleifen: ein praktischer LeitfadenFür und während Schleifen: ein praktischer LeitfadenMay 12, 2025 am 12:07 AM

Forloopsareusedwhenthenumberofiterationsisknowninadvance,whilewhileloopsareusedwhentheiterationsdependonacondition.1)Forloopsareidealforiteratingoversequenceslikelistsorarrays.2)Whileloopsaresuitableforscenarioswheretheloopcontinuesuntilaspecificcond

Python: Ist es wirklich interpretiert? Die Mythen entlarvenPython: Ist es wirklich interpretiert? Die Mythen entlarvenMay 12, 2025 am 12:05 AM

Pythonisnotpurelyinterpretiert; itusesahybridapproachofByteCodecompilation undruntimeinterpretation.1) PythoncompilessourcecodeIntoBytecode, die ISthenexecutBythepythonvirtualmachine (Pvm)

Python -Verkettungslisten mit demselben ElementPython -Verkettungslisten mit demselben ElementMay 11, 2025 am 12:08 AM

ToconcatenatelistsinpythonWithThesameElements, Verwendung: 1) Die Operatortokeepduplikate, 2) asettoremoveduplicate, or3) listenConpRectionforControloverDuplikate, EvermethodhasDifferentPerformanceInDormplocate.

Interpretiert gegen kompilierte Sprachen: Pythons PlatzInterpretiert gegen kompilierte Sprachen: Pythons PlatzMay 11, 2025 am 12:07 AM

PythonisaninterpretedLuage, OfferingaseofuseandflexibilitätsbutfacingPerformancelimitationsincriticalApplications.1) InterpretedLanguages ​​LikePythonexecutine-by-Line, ermöglicht, dassmediateFeedbackandrapidPrototyping.2) CompiledLanguagesslikec/C.5.

Für und während der Schleifen: Wann benutzt du jeweils in Python?Für und während der Schleifen: Wann benutzt du jeweils in Python?May 11, 2025 am 12:05 AM

Useforloopswhenthenumberofofiterationssisknowninadvance und wileloopswhenCiterationsDependonacondition.1) Forloopsardealforsequencelistorranges.2) Während

See all articles

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

Video Face Swap

Video Face Swap

Tauschen Sie Gesichter in jedem Video mühelos mit unserem völlig kostenlosen KI-Gesichtstausch-Tool aus!

Heißer Artikel

Nordhold: Fusionssystem, erklärt
3 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Flüstern des Hexenbaum
3 Wochen vorBy尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver Mac

Dreamweaver Mac

Visuelle Webentwicklungstools

MantisBT

MantisBT

Mantis ist ein einfach zu implementierendes webbasiertes Tool zur Fehlerverfolgung, das die Fehlerverfolgung von Produkten unterstützen soll. Es erfordert PHP, MySQL und einen Webserver. Schauen Sie sich unsere Demo- und Hosting-Services an.

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

SublimeText3 Englische Version

SublimeText3 Englische Version

Empfohlen: Win-Version, unterstützt Code-Eingabeaufforderungen!