python如何创建web_Python如何用于创建Web服务?

I always created my web services using PHP but I am interested in switching to Python because of its simplicity. On my web server (I have created a "tmp.py") just with one line:

print "Hello!"

And then I have opened this file in my browser. I was surprised that it works (I saw "Hello!"). But there are two more thinks that I need to know:

How do I access the get and post variables as well as the session?

How do I use databases from python. Does Python connects to MySQL server like PHP does or some other approach is used?

解决方案

HOWTO Use Python in the web is the official Python manual on this matter. It's a fairly good starting point, giving a brief overview on the subject, and listing the most common options:

CGI and CGI spin-offs (Fast CGI, WSGI)

mod_python

Full frameworks, most notably Django

Although I admire Python for its elegance and power, it's far from being the natural or standard choice for web development. Carefully consider the use case, and who will maintain the code, before picking the language.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值