def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return '<h1>Hello, web!</h1>'


# 1st
# Just for Test and it is single thread
from wsgiref.simple_server import make_server
httpd = make_server('', 8000, application)
httpd.serve_forever()

# 2nd
# Use paste httpserver
from paste import httpserver
httpserver.serve(application, host='127.0.0.1', port=8000)

# 3rd
# Use eventlet
import eventlet from eventlet import wsgi wsgi.server(eventlet.listen(('', 8000)), application) print "Serving HTTP on port 8000..."

 

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2022-01-01
  • 2021-05-21
  • 2022-12-23
  • 2021-11-19
  • 2022-02-09
猜你喜欢
  • 2022-02-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
相关资源
相似解决方案