LoginSignup
12
11

More than 5 years have passed since last update.

カレントディレクトリでさっくりとWebサーバを起動させる

Posted at

前置き

手元でD3.jsのサンプルを動かそうとして CrossOrigin に引っかかってしまったので、ローカルでWebサーバを起動する方法調べてみた。

サーバスクリプト

simpleserver.py
#!/usr/bin/python

import SimpleHTTPServer
SimpleHTTPServer.test()

使い方

HTTPでサーブしたいファイルが有るディレクトリに上記ファイルを設置し、以下のコマンドを実行する。

$ python simpleserver.py

念のためワンライナー

リポジトリに登録したいのでワンライナーは避けたいけど、念のため知ってるよアピール。

$ python -m SimpleHTTPServer

12
11
2

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
12
11