I needed to host a webserver with basic setup to load a file for a project. Here is what I did
1. in Mac, I opened terminal, and went to the folder that had index.html and typed
python -m SimpleHTTPServer 8000
This spit out the following log
Serving HTTP on 0.0.0.0 port 8000 ...
And it hung there. Which is indication that the server is running on port 8000
That is all that you would have to do to host a webserver on Mac with python.
In order to access this file from a different system, we need the name or ip address for localhost.
ip address can be obtained by typing ifconfig in terminal, and getting the inet address of en0 section, if you are connected to the internet via ethernet LAN cable.
Or you can go to system preferences -> Network and get the ip address given in the right side section of the preference window in Mac
After getting the ip address, if you type http://xxx.yyy.zzz.uuu:8000/index.html, it should display the webpage.
Hope this helps.
1. in Mac, I opened terminal, and went to the folder that had index.html and typed
python -m SimpleHTTPServer 8000
This spit out the following log
Serving HTTP on 0.0.0.0 port 8000 ...
And it hung there. Which is indication that the server is running on port 8000
That is all that you would have to do to host a webserver on Mac with python.
In order to access this file from a different system, we need the name or ip address for localhost.
ip address can be obtained by typing ifconfig in terminal, and getting the inet address of en0 section, if you are connected to the internet via ethernet LAN cable.
Or you can go to system preferences -> Network and get the ip address given in the right side section of the preference window in Mac
After getting the ip address, if you type http://xxx.yyy.zzz.uuu:8000/index.html, it should display the webpage.
Hope this helps.