日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

浏览器打开位置服务器,如何启动http服务器,然后打开web浏览器?

發布時間:2024/1/23 HTML 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 浏览器打开位置服务器,如何启动http服务器,然后打开web浏览器? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我正在嘗試:import multiprocessing

from wsgiref.simple_server import make_server

import webbrowser

import time

def application(environ, start_response):

start_response("200 OK", [("Content-Type", "text/plain")])

return ["Hello!"]

class Server(multiprocessing.Process):

def run(self):

print "HTTP Server starts."

server = make_server(host = "127.0.0.1",

port = 88,

app = application)

try:

server.serve_forever()

except (keyboardInterrupt, SystemExit):

print "HTTP Server stopped."

raise

httpd = Server()

httpd.start()

#webbrowser.open("http://127.0.0.1:88")

time.sleep(3)

httpd.terminate()

httpd.join()

print "End"

如果我取消對webbrowser行的注釋,瀏覽器將不會停止打開新窗口。為什么?在

我仍然不太了解多處理模塊,但是像這樣的東西應該很簡單。這是怎么做到的?在

編輯:

似乎工作得很好。在

但我想知道如何向服務器發送SystemExit信號。更好的方法?在

總結

以上是生活随笔為你收集整理的浏览器打开位置服务器,如何启动http服务器,然后打开web浏览器?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。