run.py 388 B

123456789101112131415161718192021222324
  1. # -*- coding: UTF-8 -*-
  2. import web
  3. from mod.news import News
  4. urls = (
  5. '/news','api',
  6. )
  7. # render = web.template.render('templates')
  8. app = web.application(urls, globals())
  9. #api的方法
  10. class api:
  11. def GET(self):
  12. news = News()
  13. return news.content()
  14. def POST(self):
  15. news = News()
  16. return news.content()
  17. if __name__ == '__main__':
  18. app.run()