Python Web开发,类似于PHP或经典ASP [英] Python web development that resembles PHP or classic ASP

查看:80
本文介绍了Python Web开发,类似于PHP或经典ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我一直在使用VB脚本开发经典asp中的网站,现在已经很长时间了。

。由于我也开始绕道开发ColdFusion,而且我工作的公司(编辑)从来没有花费时间或金钱用于课程,我我现在处于尴尬的位置,我是b $ b -still-开发经典的ASP。


在其中,我已经变得非常机智,我用一个框架编写了WSC

(windows脚本组件)将逻辑与表示分开,
和我的显示页几乎没有逻辑,除了循环和

变量我需要构建我的页面。我有一个三层设置,所有

业务逻辑都在单独的WSC文件中。该框架甚至使用

ORM来访问我的数据库表。这就像一个魅力。

它使得经典的ASP代码可维护,它使得经典的工作实际上非常令人愉快,这让我们的客户非常满意。


问题是经典的asp现在是一种死语言,我需要现金化和快速的
!虽然有些人反对它的争论

对我来说无效(意大利面条代码,不可维护,慢),我仍然是

看到它几乎没有支持再来一次。


更新的最合理方式我对更多东西的了解更多的是b / b现代,将潜入ASP.NET。我认为这需要很长的时间,但是有一些问题:


1.我喜欢使用内联对我的html控件,基于模板

vbscript。 ASP.NET的网页表单听起来确实是一个非常糟糕的主意,也是微软在尝试制作无状态网络应用程序时采用的方法

看起来像是一个状态良好的申请是恕我直言的负担。我认为webapps

本身与桌面应用程序不同,应该编程




2.谁说微软不会在

中拔掉VB.NET的插件,或者像从asp到asp.net那样做一个大的改动

再次,一段时间在将来?


3.我喜欢快速开发,我可以用动态的,松散类型的

语言,比如vbscript。一个站点的性能瓶颈大多数是数据库访问和http-calls,而且我认为编写所有的

强类型的声明和类型语言对于

a webapp来说太过分了。


当我开始查看其他动态语言时,我就开始讨论

webdevelopment。我查看了Ruby on Rails以及可用于Python的不同web-

框架。那对我来说最大的问题是,目前非常流行的MVC类型框架

也不是我想要的。


我喜欢让我的目录树符合我的

网站的结构,所以控制器指的是MVC开发风格的一部分是我不想要的东西。我想要的是代码分离

和显示逻辑(因此能够在页面中包含库)和

能够将代码直接混合到HTML。


由于Python是我比Ruby更喜欢的语言,我想我会在这里询问

,看看Python社区中是否有人知道如果在Python中存在这样的开发框架。例如,IronPython

是否也使用与使用VB的asp.net相同的Web表单方法?我看过的

框架(Django,Pylons)似乎能够使用

不同的模板引擎,这是否意味着它只是一个问题

找到合适的产品?


另外,对于Python来说还存在有意义的缩进问题。

我甚至不确定如果可以直接在HTML中使用Python,那么
因为缩进至少是难以维护的。我有点希望这里有一些解决这些问题的方法

可用Python。


任何帮助非常感谢。


亲切的问候,


Erik

解决方案

呃************* @ gmail.com skrev:


嗨全部,


这就是'我开始研究其他动态语言

webdevelopment。我查看了Ruby on Rails以及可用于Python的不同web-

框架。对我来说最大的问题是:b
目前非常受欢迎的MVC类型框架

也不是我想要的。



嗨Erik,


我是一名经验丰富的Python开发人员,主要在Plone工作。之前

我来自asp喜欢你。

如果你想要的东西最像你习惯的东西,你应该

check Django。我没有参与其中,但它得到了我信任的开发人员的高度赞扬。

http://www.djangoproject.com/

如果你想要更现代的话​​。你应该看看Grok。它基于Zope 2,CMF和Plone的所有经验构建了

。根据Zope 3,它是



http://grok.zope.org/


如果从今天开始,我会选择这个。

-


hilsen /问候丹麦Max M

http://www.mxm.dk/

IT'的疯狂科学


[Max M< ma ** @ mxm.dk]

呃************* @ gmail.com skrev:


>大家好,


>这就是我开始寻找其他动态语言进行web开发的时候。我查看了Ruby on Rails以及可用于Python的不同web-
框架。对我来说最大的问题是,目前非常流行的MVC类型框架也不是我想要的。



嗨Erik,


我是一名经验丰富的Python开发人员,主要在Plone工作。之前

我来自asp喜欢你。


如果你想要的东西最像你习惯的东西,你应该

查看Django。我没有参与其中,但它得到了我信任的开发人员的高度赞扬。

http://www.djangoproject.com/



Django是这些MFC类型框架之一。 OP很兴奋_not_

寻找;)


如果你想要更多现代的话你应该看看Grok。它基于Zope 2,CMF和Plone的所有经验构建了

。根据Zope 3,它是



http://grok.zope.org/


如果从今天开始,我会选择这个。



Grok与经典的asp编程非常不同,它甚至可以从HTTP中抽象出比Django更多的



-

自由永远是持不同政见者的自由。

(罗莎卢森堡)


< blockquote> [呃************* @ gmail.com < er ************* @ gmail.com]


1.我喜欢我对html的控制使用内联,基于模板的

vbscript。 ASP.NET的网页表单听起来确实是一个非常糟糕的主意,也是微软在尝试制作无状态网络应用程序时采用的方法

看起来像是一个状态良好的申请是恕我直言的负担。我认为webapps

本身与桌面应用程序不同,应该编程

这样。

[...]

3.我喜欢快速开发我可以用动态的,松散类型的

语言,比如vbscript。一个站点的性能瓶颈大多数是数据库访问和http-calls,而且我认为编写所有的

强类型的声明和类型语言对于

a webapp来说太过分了。


当我开始查看其他动态语言时,我就开始讨论

webdevelopment。我查看了Ruby on Rails以及可用于Python的不同web-

框架。那对我来说最大的问题是,目前非常流行的MVC类型框架

也不是我想要的。


我喜欢让我的目录树符合我的

网站的结构,所以控制器指的是MVC开发风格的一部分是我不想要的东西。我想要的是代码分离

和显示逻辑(因此能够在页面中包含库)和

能够将代码直接混合到HTML。



总结一下,您正在寻找一个框架,它允许您在模板中嵌入

多个代码,遵循经典的目录结构

传统网站并且具有ORM功能,但不像桌面版

编程或使用MVC模式。


在这种情况下我觉得不得不让你失望,我不知道任何这样的事情

for python。你必须将它们放在不同的组件中。


我想,使用一个简单的WSGI包装器作为Werkzeug或Paste,并将它组合成

和一个强大的ORM喜欢SQLAlchemy和模板引擎,它允许你在模板中嵌入完整的python代码(例如Mako),最好的套装

你的需求,因为它给你设计应用程序的自由

你的想法。


现代框架如Django或Grok需要一个很好的适应,

因为他们强烈地限制了程序员的自由。我怀疑,你是否会让Django或Grok像你的asp框架一样工作。


-

自由永远是反对者的自由。

(罗莎卢森堡)


Hi All,

I have been developing websites in classic asp using VB script for a
long while now. Due to the fact that I also took a detour to
developing ColdFusion, and the fact the companies I work(ed) for never
had time or money for courses, I am now in the awkward position that I
am -still- developing classic ASP.

In it, I have become quite resourceful, I wrote a framework using WSC
(windows scripting components) to separate logic from presentation,
and my display pages use almost no logic, except for the loops and
variables I need to build my pages. I have a three-tier setup and all
business logic is in separate WSC files. The framework even uses an
ORM for access to the tables of my database. This works like a charm.
It makes classic ASP code maintainable, it makes working in classic
ASP very pleasant actually and it makes our customers very happy.

The problem is that classic asp is now a dead language, I need to
modernize and fast! Although the arguments some people make against it
are not valid for me (spaghetti code, unmaintainable, slow), I still
see that there is little to no support for it anymore.

The most logical way to "update" my knowledge to something more
modern, would be to dive into ASP.NET. I considered that for a long
time, but there are some problems with this:

1. I love the control I have over my html using inline, template-based
vbscript. ASP.NET''s web forms really sound like a very bad idea, also
the approach Microsoft takes in trying to make a stateless web-app
seem like a statefull application is IMHO a burden. I think webapps
are inherently different than desktop apps, and should be programmed
as such.

2. Who says Microsoft isn''t going to pull the plug on VB.NET in a
while or make a drastic change like they did from asp to asp.net
again, some time in the future?

3. I like the rapid development I can do in a dynamic, loosely typed
language like vbscript. The performance-bottleneck of a site is mostly
in the database-access and the http-calls and I think writing all of
the declarations and types for a strong-typed language is overkill for
a webapp.

So that''s when I started looking at other dynamic languages for
webdevelopment. I looked at Ruby on Rails and at the different web-
frameworks that are available for Python. The biggest problem there
for me is that the MVC type frameworks that are currently very popular
are also not what I''m looking for.

I like having my directory tree conform to the structure of my
website, so the "Controller" part of the MVC style of development is
something I wouldn''t want. What I -would- like is a separation of code
and display logic (so being able to include libraries in a page) and
being able to intermix code directly into the HTML.

As Python would be the language I prefer over Ruby, I thought I''d ask
here to see if anyone in the Python community knows if such a
development-framework exists in Python. For example, does IronPython
also use the same web forms approach as asp.net using VB? The
frameworks I looked at (Django, Pylons) seem to be able to use
different templating engines, does that mean it''s just a question of
finding the right one?

Also, for Python there is also the problem of meaningful indentation.
I''m not even sure if it''s possible to use Python directly inside HTML,
because indentation would be at the very least tricky to maintain. I''m
kind of hoping here that there are some solutions to these problems
available in Python.

Any help would be greatly appreciated.

Kind regards,

Erik

解决方案

er*************@gmail.com skrev:

Hi All,

So that''s when I started looking at other dynamic languages for
webdevelopment. I looked at Ruby on Rails and at the different web-
frameworks that are available for Python. The biggest problem there
for me is that the MVC type frameworks that are currently very popular
are also not what I''m looking for.

Hi Erik,

I am an experienced Python developer working mostly in Plone. Before
that I came from asp like you.
If you want something that is most like what you are used to, you should
check out Django. I have not worked in it, but it get high praises from
developers I trust.

http://www.djangoproject.com/
If you want a more "modern" approach you should check out Grok. It has
been built on all the experiences made with Zope 2, CMF and Plone. It is
based on Zope 3.

http://grok.zope.org/

It is the one I would choose if starting from fresh today.
--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT''s Mad Science


[ Max M <ma**@mxm.dk]

er*************@gmail.com skrev:

>Hi All,

>So that''s when I started looking at other dynamic languages for
webdevelopment. I looked at Ruby on Rails and at the different web-
frameworks that are available for Python. The biggest problem there
for me is that the MVC type frameworks that are currently very popular
are also not what I''m looking for.


Hi Erik,

I am an experienced Python developer working mostly in Plone. Before
that I came from asp like you.
If you want something that is most like what you are used to, you should
check out Django. I have not worked in it, but it get high praises from
developers I trust.

http://www.djangoproject.com/

Django is one of these "MFC type frameworks" the OP was excatly _not_
looking for ;)

If you want a more "modern" approach you should check out Grok. It has
been built on all the experiences made with Zope 2, CMF and Plone. It is
based on Zope 3.

http://grok.zope.org/

It is the one I would choose if starting from fresh today.

Grok too is very different from classic asp programming, it even abstracts
much more from HTTP than Django does.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)


[ er*************@gmail.com <er*************@gmail.com]

1. I love the control I have over my html using inline, template-based
vbscript. ASP.NET''s web forms really sound like a very bad idea, also
the approach Microsoft takes in trying to make a stateless web-app
seem like a statefull application is IMHO a burden. I think webapps
are inherently different than desktop apps, and should be programmed
as such.
[...]
3. I like the rapid development I can do in a dynamic, loosely typed
language like vbscript. The performance-bottleneck of a site is mostly
in the database-access and the http-calls and I think writing all of
the declarations and types for a strong-typed language is overkill for
a webapp.

So that''s when I started looking at other dynamic languages for
webdevelopment. I looked at Ruby on Rails and at the different web-
frameworks that are available for Python. The biggest problem there
for me is that the MVC type frameworks that are currently very popular
are also not what I''m looking for.

I like having my directory tree conform to the structure of my
website, so the "Controller" part of the MVC style of development is
something I wouldn''t want. What I -would- like is a separation of code
and display logic (so being able to include libraries in a page) and
being able to intermix code directly into the HTML.

Summarising, you are searching for a framework, which allows you to embed
much code in templates, follows the directory structure of a classic
conventional website and has ORM features, but does not resemble desktop
programming or use the MVC pattern.

In this case I feel like have to disappoint you, I don''t know any such thing
for python. You will have to put this together from different components.

I guess, using a simple WSGI wrapper as Werkzeug or Paste, and combining it
with a powerful ORM like SQLAlchemy and a templating engine, which allows
you to embed full python code in the templates (e.g. Mako), will best suite
your needs, as it gives you the freedom to design the application following
your ideas.

Modern frameworks like Django or Grok require a somewhat great adaption,
since they strongly restrict the programmer''s freedom. I doubt, that you
would get Django or Grok working like your asp framework.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)


这篇关于Python Web开发,类似于PHP或经典ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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