Start the web server in the current directory

Preface

I got stuck in CrossOrigin trying to run the D3.js sample at hand, so I tried to find out how to start the web server locally.

Server script

simpleserver.py


#!/usr/bin/python

import SimpleHTTPServer
SimpleHTTPServer.test()

How to use

Place the above file in the directory where the file you want to serve with HTTP exists, and execute the following command.

$ python simpleserver.py



## One liner just in case
 I want to avoid one-liner because I want to register it in the repository, but I know it just in case.

```$ python -m simplehttpserver```




Recommended Posts

Start the web server in the current directory
Publish the current directory on the web server
Launch an HTTP server in the current directory
Pipfile is not created in the current directory
How to know the current directory in Python in Blender
Test.py is not reflected on the web server in Python3.
Hit the web API in Python
Command for the current directory Python
Pin current directory to script directory in Python
Install the Python module in any directory
Current directory structure
Log in to the remote server with SSH
Run the task in the background on the sshed server
Extract only the file name excluding the directory in the directory
Access files in the same directory as the executable
Regularly monitor the HTTP response of the web server
Start a simple Python web server with Docker
Create a Django project and application in a Python virtual environment and start the server
Create a web server in Go language (net/http) (2)
Unzip all zip files under the current directory
Execute the command on the web server and display the result
Create a web server in Go language (net / http) (1)
Install django on python + anaconda and start the server
Web server construction commentary
One Liner Web Server
Ubuntu (18.04.3) Web server construction
DNS server in Python ....
Merry Christmas web server
Display "Hello World" created in the local environment on the web
Launch a simple WEB server that can check the header
Minimum load test knowledge gained in the first API server load test
[Note] Import of a file in the parent directory in Python
Get the current date and time in Python, considering the time difference
When you access the web server, L Chika with Arduino
Image Optimize on the server side using TinyPNG's Web API
Flask Web server cannot be published to the outside [VScode]
Run the output code on the local web server as "A, pretending to be B" in python
Prevent unnecessary directories from being created under the current directory when you start project with Django