Skip to content

Instantly share code, notes, and snippets.

@zhanglongqi
Created July 9, 2017 10:21
Show Gist options
  • Select an option

  • Save zhanglongqi/8ca3aadb357d1cdb0b625dc7e85f53f1 to your computer and use it in GitHub Desktop.

Select an option

Save zhanglongqi/8ca3aadb357d1cdb0b625dc7e85f53f1 to your computer and use it in GitHub Desktop.
change the root path of Python http.server
from os import chdir
from os.path import join, dirname
from http.server import SimpleHTTPRequestHandler, test
chdir(join(dirname(__file__), 'YOUR_WEB_ROOT_PATH'))
test(SimpleHTTPRequestHandler, port=8080, bind='0.0.0.0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment