Local HTTP server using Python
How to run a local HTTP server using Python to check your website functionality easily
Topics: Web Development,Python
If youâre working on simple HTML/CSS/JS websites and need to test certain functionalities that donât operate correctly when running the .html
 file directly (like cookies), hereâs a straightforward method to set up your own local HTTP server:
- Download and install the latest version of Python.
- Navigate to the folder containing your website files and open the terminal (or Command Prompt) in that location.
- If youâre using Windows, you can do this by holding down theÂ
Shift
 key, right-clicking on an empty space within the folder, and selectingÂOpen in Terminal
.
- If youâre using Windows, you can do this by holding down theÂ
- In the terminal, execute the commandÂ
python -m http.server
. - Launch any web browser and enterÂ
http://localhost:8000/
 in the address bar. - If everything is set up correctly, you should be able to view your website.