How to Open HTML Files in Browser With Hot Reload Using a Python Built in HTTP Server
27 views
Jun 3, 2025
Get the full source code of application here:
View Video Transcript
0:00
uh hello guys welcome to this video So
0:02
in this video I will show you a built-in
0:05
uh HTTP development server of Python So
0:08
if you have Python installed on your
0:10
machine there is a built-in HTTP
0:12
development server that you can actually
0:13
run any file So let's suppose I create a
0:17
simple index.html file which I need to
0:19
run it inside the
0:21
browser So Python does come with a
0:24
built-in development server Now to run
0:27
this file you go to the terminal and
0:29
simply execute this command and just
0:32
write here
0:34
python-m you for this you need to have
0:37
python installed so just check your
0:40
version I running the latest version
0:42
which is 3.10.5
0:43
10.5 and then you just need to say
0:45
python -
0:48
m http dash server So python-m after
0:54
that you simply write http dash server
0:58
dots
1:00
server So this is the command here So
1:03
this will actually start the development
1:05
server on localhost by default on this
1:08
port number which is 8,000 So if you try
1:11
to open
1:13
this you will see
1:16
that So by default you it will open your
1:19
HTML file Here you will
1:21
see So in this easy way you can open any
1:26
HTML CSS or JavaScript any HTML file
1:31
using the Python development local
1:33
development server with hot auto reload
1:36
So if you make any sort of changes here
1:38
you will see it will hot auto reload If
1:41
I add this you will see if I refresh it
1:45
you will see that the changes will be
1:47
reflected back I can add some CSS code
1:51
here Let me make the background color to
1:57
red So you can see we can even write
2:00
JavaScript code here you can
2:06
add So in this easy way this is the
2:09
Python local development server For this
2:12
you don't need did not have to install
2:13
any package Just execute this command in
2:16
the terminal and then it will load and
2:18
open your HTML file right here So thank
2:21
you very much for watching this video
2:23
and uh also check out my website
2:26
freemediattools.com
2:27
uh which contains thousands of tools
#Software