Serve a Directory via Python
Sometimes I'm working with a test HTML file and some JavaScript but need to work off of a served space. In that case, I sometimes need to swap out folders within MAMP Stack which leads to a maintenance nightmare. Bleh.
I recently found out that you can serve up a directory using one Python command line directive:
# Serves the current directory at: http://0.0.0.0:8000/
python -m SimpleHTTPServer
Excellent. No more directory and MAMP Stack juggling. Even better is that the command is easy to memorize so no need to constantly look it up. Keep this in mind when you want to work on something without a big server install!
Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user. One of those simple APIs the Vibration API. The Vibration API allows developers to direct the device, using JavaScript, to vibrate in...
This is the hardest thing I've ever had to write, much less admit to myself. I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life. All of those feelings were very...
If you follow me on Twitter, you saw me rage about trying to make position: absolute
work within a TD
element or display: table-cell
element. Chrome? Check. Internet Explorer? Check. Firefox? Ugh, FML. I tinkered in the console...and cussed. I did some researched...and I...
https://www.npmjs.com/package/http-server
That’s even easier.
Nice!
Python comes preinstalled on number of OS’s though.
Python 3 has a different syntax too.
I think it’s
Except this only works under Python 2. The Python 3 command is slightly different.
Ever seen Fenix Web Server? I’m totally bias (I’m the author), but I think it works well :-) Has a GUI and a CLI, persistent servers, and an SSH tunneling tool for securely and temporarily sharing with others.
You can also do this very easily with php: