Prerequisites: | You need to first know how the Internet works, and what a Web server is. |
---|---|
Objective: | You will learn how to set up a local testing server. |
file://
followed by the path to the file on your local hard drive, a local file is being used. In contrast, if you view one of our examples hosted on GitHub (or an example on some other remote server), the web address will start with http://
or https://
, to show that the file has been received via HTTP.http.server
module.SimpleHTTPServer
. If you are using Python 2.x, you can follow this guide by replacing all uses of http.server
with SimpleHTTPServer
. However, we recommend you use the latest version of Python.cd
command.localhost:8000
in your web browser. Here you'll see the contents of the directory listed — click the HTML file you want to run.python3 -m http.server 7800
(Python 3.x) or python -m SimpleHTTPServer 7800
(Python 2.x). You can then access your content at localhost:7800
.http.server
(or SimpleHTTPServer
for Python 2) module is useful, but it is merely a static file server; it doesn't know how to run code written in languages such as Python, PHP or JavaScript. To handle them, you'll need something more — exactly what you'll need depends on the server-side language you are trying to run. Here are a few examples:Prerequisites: | You need to first know how the Internet works, and what a Web server is. |
---|---|
Objective: | You will learn how to set up a local testing server. |
file://
followed by the path to the file on your local hard drive, a local file is being used. In contrast, if you view one of our examples hosted on GitHub (or an example on some other remote server), the web address will start with http://
or https://
, to show that the file has been received via HTTP.http.server
module.SimpleHTTPServer
. If you are using Python 2.x, you can follow this guide by replacing all uses of http.server
with SimpleHTTPServer
. However, we recommend you use the latest version of Python.cd
command.localhost:8000
in your web browser. Here you'll see the contents of the directory listed — click the HTML file you want to run.python3 -m http.server 7800
(Python 3.x) or python -m SimpleHTTPServer 7800
(Python 2.x). You can then access your content at localhost:7800
.http.server
(or SimpleHTTPServer
for Python 2) module is useful, but it is merely a static file server; it doesn't know how to run code written in languages such as Python, PHP or JavaScript. To handle them, you'll need something more — exactly what you'll need depends on the server-side language you are trying to run. Here are a few examples: