Professional Documents
Culture Documents
developer.mozilla.org
Throughout most of the learning area, we tell you to just open your
examples directly in a browser — this can be done by double
clicking the HTML file, dragging and dropping it into the browser
window, or choosing File > Open... and navigating to the HTML
file. There are many ways to achieve this.
If the web address path starts with 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.
Some examples won't run if you open them as local files. This can
1 of 5 4/4/22, 2:21 AM
How do you set up a local testing server? - Learn web development | MDN about:reader?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%...
To do this:
2 of 5 4/4/22, 2:21 AM
How do you set up a local testing server? - Learn web development | MDN about:reader?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%...
can get an installer from the Python homepage and follow the
instructions to install it:
!"Go to python.org
!"Under the Download section, click the link for Python "3.xxx".
!"At the bottom of the page, click the Windows Installer link to
download the installer file.
!"On the first installer page, make sure you check the "Add Python
3.xxx to PATH" checkbox.
!"Click Install, then click Close when the installation has finished.
3 of 5 4/4/22, 2:21 AM
How do you set up a local testing server? - Learn web development | MDN about:reader?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%...
5. By default, this will run the contents of the directory on a local web
server, on port 8000. You can go to this server by going to the URL
localhost:8000 in your web browser. Here you'll see the
contents of the directory listed — click the HTML file you want to
run.
!"To run Python server-side code, you'll need to use a Python web
framework. There are many popular Python web frameworks, such
as Django (a guide is available), Flask, and Pyramid.
4 of 5 4/4/22, 2:21 AM
How do you set up a local testing server? - Learn web development | MDN about:reader?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%...
5 of 5 4/4/22, 2:21 AM