3 ms·
If you have python-twisted installed, you can also use this one-liner: python -c 'from twisted.web.server import Site; from twisted.web.static import File;
by chatmasta 11y ago
If you have python-twisted installed, you can also use this one-liner:
python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(4545, Site(File("/your/static/file/directory/"))); reactor.run()'
I was unable to watch HTML5 video using the `python -m SimpleHTTPServer`, but with twisted it works. Not sure why but it's somehow related to streaming content.
- WorldMaker 11y agoEasiest explanation is MIME type information. http.server module has only the bare minimum support for MIME types. Per standards things like HTML5 video tag are very reliant on MIME type information. I'd be willing to guess twisted handles a lot more MIME types. Next most likely after that would probably be CORS which is also a HTTP header issue that something like 'http.server' implements only the bare minimum for. Of course both of those are just a guess. If you had captured the output of your browser's dev console/F12 tools you likely would have seen what specifically your particularly browser was complaining about.