LoginSignup
2
1

More than 5 years have passed since last update.

SimpleHTTPServerでmime typeを追加、文字コードを指定

Last updated at Posted at 2015-07-05

参考

.mdtext/plainでmime登録

httpsrv.py
#!/usr/bin/python
import SimpleHTTPServer
import SocketServer
import mimetypes

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

Handler.extensions_map['.md']='text/plain;charset=UTF-8'
httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()

Handler.extensions_map['.md']='text/plain;charset=UTF-8'

が重要

起動

python httpsrv.py
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1