Reference: https://webapp-improved.appspot.com/tutorials/quickstart.nogae.html
Step 1: install pip
Step 2:
$ pip install WebOb $ pip install Paste $ pip install webapp2
Step 3:
write a main.py
import webapp2 class HelloWebapp2(webapp2.RequestHandler): def get(self): self.response.write(‘Hello, webapp2!‘) app = webapp2.WSGIApplication([ (‘/‘, HelloWebapp2), ], debug=True) def main(): from paste import httpserver httpserver.serve(app, host=‘127.0.0.1‘, port=‘8080‘) if __name__ == ‘__main__‘: main()
Step 4:
Run
$ python main.py
时间: 2024-10-13 20:40:46