TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Serve – like python -m SimpleHTTPServer, but with gzip and http2

18 pointsby rhardihabout 9 years ago

3 comments

earthboundkidabout 9 years ago
This doesn&#x27;t make any sense to me. And I&#x27;ve written a Go reverse proxy server <a href="https:&#x2F;&#x2F;github.com&#x2F;carlmjohnson&#x2F;simple-reverse-proxy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;carlmjohnson&#x2F;simple-reverse-proxy</a> .<p>Python&#x27;s SimpleHTTPServer is for when you have some directory on your computer and you want to test it locally in the browser. That&#x27;s all. So, there&#x27;s no reason to use GZIP or HTTP2 with a SimpleHTTPServer replacement. If you need those features, it&#x27;s because you&#x27;re doing things _in production_, in which case you should use Nginx, Apache, or Caddy (if you really want to use something Go-based).<p>TL;DR: If you need GZIP&#x2F;HTTP2, it&#x27;s not &quot;simple.&quot;
评论 #11634737 未加载
chatmastaabout 9 years ago
If you have python-twisted installed, you can also use this one-liner:<p><pre><code> python -c &#x27;from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(4545, Site(File(&quot;&#x2F;your&#x2F;static&#x2F;file&#x2F;directory&#x2F;&quot;))); reactor.run()&#x27; </code></pre> I was unable to watch HTML5 video using the `python -m SimpleHTTPServer`, but with twisted it works. Not sure why but it&#x27;s somehow related to streaming content.
评论 #11615766 未加载
Socketubsabout 9 years ago
It&#x27;s like `python3 -m http.server` but in a language that is rarely pre-installed on systems with an external program that has two external dependencies.
评论 #11612084 未加载
评论 #11611915 未加载