I am writing a very simplistic application in Python3 which simply runs certain server-side commands from POST input received via the Python http.server.BaseHTTPRequestHandler, HTTPServer modules.
Currently, my code is as follows:
mysql_tools.f_print("Starting HTTP server on %s:%s.." % SERVER_ADDRESS)
httpd = HTTPServer(SERVER_ADDRESS, S)
mysql_tools.f_print("Server started. Now serving port %s." % SERVER_ADDRESS[1])
httpd.serve_forever()
Where S is the BaseHTTPRequestHandler class.
Now, I want to be able to have console input also. The application runs in a CMD window and simply displays "Server started. Now serving port 1010", however I want to be able to type, for example, "stop" into the CMD window and process accordingly, or "restart" or "forcerequest" etc etc. But as you may know, it does not have any input because of the "serve_forever()", it disregards any future lines of code as it appears to loop indefinitely.
Any advice or alternate ways to serve the port would be appriciateted.