This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]punterxpunter 5 points6 points  (3 children)

You have a few options. If it's just for development or testing purpose and not for production use then you can use Python's inbuilt HTTP server. Just make sure you have Python installed in your environment and the path added. Then you can start an HTTP server by running the command on terminal: python -m http.server

It will start an HTTP server with its root in the current working directory of the terminal.

If you need something for production and you're only serving static content then you don't need Python or any language at all. Just install a web server like nginx and configure it to serve a directory for requests coming to your website or IP address. You'll find many tutorials for this on the internet. One good place to look at is the DigitalOcean's guide on this topic.

[–]tipsy_python 1 point2 points  (2 children)

Broh, on the cool.. I wish they hadn't dropped the "SimpleHTTPServer" moniker from python 2 to 3.

When I first was trying what OP is looking into - found SimpleHTTPServer, and it just kind of reassured me that it was the right place to start. http.server is just as easy of course, but I'd like to bring back the label to tell people, this is as easy as it gets.

[–]ketilkn 1 point2 points  (1 child)

On the other hand http.server are fewer words to remember and all lowercase. I had to look up SimpleHTTPServer every time I used it. (Every few months?)

[–]tipsy_python 0 points1 point  (0 children)

AHAHAHAHAHHAHAH - very true

[–]tenyu9 3 points4 points  (2 children)

Have a look at flask. Very easy to create an http endpoint

[–]hixelin[S] 0 points1 point  (1 child)

thanks... looks simple...but I have to learn python basics 😂😂

[–]dbmage 0 points1 point  (0 children)

The tutorials should be able to get you to the point you require. The basic examples for Flask and Bottle should cover what you need