我是
Python的新手,我想开始用它构建Web页面(但不使用Web框架或模板模块).最低要求是什么?你能建议一个简单的设置吗?

谢谢!

编辑:我不是不惜一切代价都是极简主义者.我正在寻找的是一个简单,通用的解决方案,与语言保持接近(并没有强加设计范例,例如MVC).

解决方法

我顺其自然,我建议使用轻量级框架.

首先,Web应用程序会使您的服务器面临安全风险,因此最好使用由或多或少的大型开发人员社区维护的内容(更多的眼球来修复漏洞).

此外,如果您想“保持接近语言”,您需要某种抽象层来以pythonic方式管理HTTP. Python完全是关于高级别[包括电池].

一些框架非常接近python的语法,语义和风格.以webpy为例.我认为这句话说明了webpy背后的许多哲学:

“Django lets you write web apps in Django. TurboGears lets you write web apps in TurboGears. Web.py lets you write web apps in Python.” — Adam Atlas

在简洁和使用“常规”Python方面的另一个好的候选人是cherrypy.从他们的网站:

CherryPy allows developers to build web applications in much the same way they would build any other object-oriented Python program. […] Your CherryPy powered web applications are in fact stand-alone Python applications embedding their own multi-threaded web server. You can deploy them anywhere you can run Python applications.

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。