Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKen Rodgers
6,567 PointsI have Python 3.5 so the command for an HTTP server is now python -m http.server [<portNo>] in case you want to add it
Mostly a comment. I have Python 3.5 so the command for an HTTP server is now python -m http.server [<portNo>] in case you want to add it
python -m http.server 8000
then allow the firewall exception
1 Answer
Manuel A. Martinez
10,919 PointsHi Ken; Just to give more insight on the topic:
Although it works great for testing, http.server is not recommended for production. It only implements basic security checks.
Steps to make it work: (on Linux)
- Open a terminal and type:
$ cd ~
$ mkdir MyRootHTML
$ cd MyRootHTML
$ nano index.html
- Go ahead and type and save the following in the index.html file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Python Powered HTTP Server</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
- Go ahead and type the following in the terminal:
python3 -m http.server 8000
- And finally, open a web browser and type in the following address:
http://localhost:8000
You can also refer to python's http.server documentation by clicking here.