webpy

来自百合仙子's Wiki
跳转到导航 跳转到搜索

示例

以下示例可单独运行,也可在 wsgi 环境下运行(调用 application 的方法)

import web

class test:
  def GET(self):
     web.header('Content-Type', 'text/plain')
     return "Hello, webpy!"

urls = (
  '/.*', 'test',
)

app = web.application(urls, globals())
application = app.wsgifunc()

if __name__ == "__main__":
  app.run()

响应

设置响应头

web.header('Content-Type', 'text/plain')