查看: 4641|回复: 12

Introducing WEB2PY: Build a Python web app in less than two minute

[复制链接]
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
跳转到指定楼层
1#
发表于 2009-9-5 19:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
I discovered web2py last night. This is unlike any web framework you’ve ever seen and its open source and 100% free. With web2py the batteries are included and there is zero to install additionally or configure. Its all self-contained, in fact you don’t even need a code editor to work with the scripts since one is provided and hosted in the web browser. The language used is Python and you’ll find a Python interpreter is already included as well. Simply download, extract, and then run the executable and your up and running and ready to create your first web app.
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
2#
 楼主| 发表于 2009-9-5 19:14 | 只看该作者
The documentation is excellent and includes a rather large introduction to using web2py as well a nice refresher/tutorial on the Python language itself. There are plenty of examples as well.

I did a “Hello World” tutorial in less than two minutes. Once I had web2py downloaded and extracted (I’m using Windows XP on a Virtual Machine) I went ahead and ran the “web2py.exe” file and was greeted with the following window:

web2py_1.jpg (12.09 KB, 下载次数: 12)

web2py_1.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
3#
 楼主| 发表于 2009-9-5 19:14 | 只看该作者
I entered “password” as my admin password. Once the server fires up it opens in your default browser to the following introduction page:

web2py_2.jpg (39.72 KB, 下载次数: 5)

web2py_2.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
4#
 楼主| 发表于 2009-9-5 19:16 | 只看该作者
Clicking on the admin link it takes you to a page that shows what all web apps are installed as well as a way to upload news ones or to create one. In this case I created one called “HelloWorld”.

web2py_3-300x229.jpg (16.95 KB, 下载次数: 7)

web2py_3-300x229.jpg

web2py_4.jpg (5.3 KB, 下载次数: 4)

web2py_4.jpg

web2py_5-300x214.jpg (15.4 KB, 下载次数: 8)

web2py_5-300x214.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
5#
 楼主| 发表于 2009-9-5 19:16 | 只看该作者
From here if you enter the address: http://127.0.0.1:8000/HelloWorld you would see this page which is the default page generated with new projects:

web2py_6-300x288.jpg (22.94 KB, 下载次数: 4)

web2py_6-300x288.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
6#
 楼主| 发表于 2009-9-5 19:17 | 只看该作者
If you look at the code for the default.py controller you see it lays out the code in a nice format right within your browser.

web2py_7-300x220.jpg (21.74 KB, 下载次数: 5)

web2py_7-300x220.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
7#
 楼主| 发表于 2009-9-5 19:17 | 只看该作者
Even though web2py already generated the “Hello World” for me – and with a fancier effect I’m still going to modify the code just to show how nice the code editor is they packaged with web2py. So go ahead and edit the “default.py” code.

web2py_8-257x300.jpg (24.86 KB, 下载次数: 6)

web2py_8-257x300.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
8#
 楼主| 发表于 2009-9-5 19:17 | 只看该作者
Change the default code for the “index” method to the following (yes, we are making it pretty ugly and boring by doing this):

web2py_9.jpg (4.76 KB, 下载次数: 5)

web2py_9.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
9#
 楼主| 发表于 2009-9-5 19:18 | 只看该作者
Now go ahead and refresh the tab/page where the “HelloWorld” project is running and you should see this.

web2py_10.jpg (9.59 KB, 下载次数: 4)

web2py_10.jpg

使用道具 举报

回复
论坛徽章:
277
马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11版主9段
日期:2012-11-25 02:21:03ITPUB年度最佳版主
日期:2014-02-19 10:05:27现任管理团队成员
日期:2011-05-07 01:45:08
10#
 楼主| 发表于 2009-9-5 19:18 | 只看该作者
(Keep in mind you can edit the index.html view to make it look nicer if you wanted to)

It doesn’t get any easier than that. Make sure to read the excellent documentation over as well as the ease of integrating AJAX and you’ll see this really is a fantastic Python web framework.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表