介绍几个python web framework

Are there other web frameworks?

进入python世界也能发现很多web frameworks ,如何选择又一次成为一个问题。还是先看看介绍吧。来自[url]http://wiki.pylonshq.com/display/pylonscookbook/Concepts+of+Pylons[/url]

[quote]

Django
Django is oriented to programmers who deal mainly with content. The makers of Django are from the newspaper business. They say that they were often asked to implement certain features on their web site with tight deadlines. So they wrote their own framework. Django does not re-use many components. Even their way to access databases (the so called object-relational mapper) is home-made.

If you have similar requirements as Django's makers you will find that it is an excellent framework. But it is not meant to have its components replaced easily in case you don't like them. Their templating language is not very "pythonic" - it is a language of its own although an easy one. A nice feature is their admin frontend - it will create HTML forms for you to easily manage the data in your database. And it comes with a nifty way to map URLs to certain functions in your application based on regular expressions.

AJAX is basically possible with Django but not very comfortable. They have a web server built in but they suggest you run Django applications on an Apache with mod_python. One thing that can truly be said about Django: they have good marketing. Django is well documented, has a large community and there is even a book currently written. All in all Django is a "don't worry - be happy" framework that is tightly integrated and which will help you get things done quickly if you don't care too much which components it uses and don't expect all parts to look perfectly pythonic. It's a bit magical.

面向内容的应用。admin管理后台很强。文档很好,大社区支持
[/quote]


[quote]
Turbogears
Turbogears makes use of existing components. Their web server runs on CherryPy, their HTML templates come from Kid, they access databases through SQLObject and even include a good way to write interactive AJAX applications through the use of a Javascript library called Mochikit that is tightly integrated.

They make it easier than Django to replace certain components in case you don't like them. For example you can throw away SQLObject and use SQLAlchemy instead; although many parts of Turbogears still lack full support for SQLAlchemy. Turbogears's URL mapping scheme is less explicit. You can't tell what is supposed to happen for certain URLs. Instead a program of the same name as the first part of the URL is called. So the URLs the user sees may appear less nifty.

A nicer feature is their set of web-based utilities. Among them is their WidgetBrowser to browse the library of supplied form elements - or Catwalk - a database administration frontend similar to that which Django provides. Turbogears is well documented and has a large community, too. All in all Turbogears has nifty features like its widget library or a good set of utility functions that make life easier.

Its documentation is somewhat incomplete and contains recipes and examples rather than a nice reference. A move to SQLAlchemy has been publicly announced but many features currently only work well with SQLObject. Turbogears may be a nice choice for programmers who are scared by the magic of Django and like it a bit more explicit.
[/quote]
[quote]
Pylons
Pylons isn't exactly new but appears to have a smaller community than Django or Turbogears. That does not mean it's technically worse than other frameworks. It is unique in that it is more minimal and flexible than other frameworks. Basically you need to learn the basics of the components it uses. Next you need to understand how these components are controlled from within a Pylons application. So Pylons is the glue between the components with an additional powerful package called "Webhelpers" that aids in many areas from AJAX to RSS feed creation.

Pylons' flexibility means that you can exchange the components very easily. You don't like SQLAlchemy? Use SQLObjects. You read that Myghty is superseded by Mako? Use Mako. Pylons may not always hold your hand but it will try to make it easy to use different components than what Pylons uses by default. And you will likely be happy with what Pylons offers by default. The components are carefully chosen by looking at what other web frameworks do wrong.

The documentation for Pylons is still lacking and there is no "Pylons Handbook" yet. It seems like some fans of Pylons tried it because they generally liked the idea of web frameworks but were frustrated with Django or Turbogears. [b]Some say that Pylons is the Ruby-on-Rails written in Python.[/b]

简单的说就是python版的ror 组件概念强 文档不全

[/quote]
自动化环境搭建 1、Python(推荐使用ActivePython,这个版本PATH已经配好了,也安了一些像pip这样的包) 2、WxPython(安装,保持勾选状态,不要把勾去掉!!!) 3、安装rf,以管理员身份运行cmd, pip install robotframework 4、安装RIDE,以管理员身份运行cmd, pip install robotframework-ride 5、安装Selenium2Library,以管理员身份运行cmd,pip install robotframework-selenium2library 6、安装python32位拓展,以管理员身份运行cmd,pip install pywin32 7、安装DatabaseLibrary , 以管理员身份运行cmd, pip install robotframework-databaselibrary 安装VCForPython27 安装vcredist_x64 安装驱动MySQL-python-1.2.3.win-amd64-py2.7(根据电脑自行选择32,64) 8、pip install pyodbc 需要更新setuptools,运行pip install --upgrade setuptools pip(第一遍报错,在执行一遍命令即可) 然后安装连接pyodbc的驱动mysql-connector-odbc-5.3.9-winx64.msi。(安装到这一步就完成了。下面是测试步骤,所有安装完成后再测试也可以)安装完成后打开   打开数据源添加驱动(添加按钮)   填写完整后点击test返回successful表示成功   选择库 打开robot新建测试用例输入如下内容   Connect To Database Using Custom Params 连接数据库的关键字 pyodbc 连接数据库的工具 database='test', 数据库的名字 user='root', 连接数据库的用户名 password='', 密 码 host='127.0.0.1', 数据库的IP port=3306, 数据库的端口号 Driver='{MySQL ODBC 5.3 Unicode Driver}' 数据库的驱动 query 查询语句 Disconnect From Database 断开连接数据库   Execute Sql String     执行sql语句 9、安装AutoItLibrary库(模拟键盘鼠标操作) 安装(选择x64安装) (路径改一下,因为program files(x86)路径win系统似乎会禁止读写,改成c:\AutoIt3即可) 安装 解压后,使用cmd(管理员启动),cd到包目录执行python setup.py install命令安装 9、pip freeze检查安装包 启动ride: 命令进入ride: 1:cmd; 2:cd c:\; 3:cd Python27; 4:cd Scripts; 5:输入命令:python ride.py。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值