First of all http.server module is not intended for production. It is not designed to be that at all. Placing a file called 404.html in web root does not mean it will be taken as 404 page from web server at all. You need to specify the webserver what to do in case of 404 event.
Use Nginx if you already have your html files. If you are on debian based systems sudo apt install nginx and put your html files in /var/www/html. Everything about this is customizable so all you need is do a small bit of research.
http.servermodule is not intended for production. It is not designed to be that at all. Placing a file called404.htmlin web root does not mean it will be taken as 404 page from web server at all. You need to specify the webserver what to do in case of 404 event.python3 -m http.servercuz i am on Linux.sudo apt install nginxand put your html files in/var/www/html. Everything about this is customizable so all you need is do a small bit of research.