How to serve any file type with Python's BaseHTTPRequestHandler

后端 未结 3 1423
醉酒成梦
醉酒成梦 2021-02-13 21:06

Consider the following example:

import string,cgi,time
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

class MyHandler(         


        
3条回答
  •  萌比男神i
    2021-02-13 21:52

    If you want to share files in a folder of any type, then you can also try typing the command

    python -m SimpleHTTPServer
    

    This will start the server at port 8000 and you can browse the files (via directory listing)

提交回复
热议问题