I have an HTTP server and every time I add a function or add a print mechanism
it Brings me an error. For example in this Situation I am trying to have a management console and I go to the URL of the server and well nothing but a cannot connect in Google Chrome.
Does it only accept just the http.serve_forever()? Or is it possible to have a management console after the console has started. Because that is what I am trying to do. But there is no URL to view the HTTP Server. Meaning httpd.serve_forever() does not function properly in my view. Is there any way to fix this?
import http.server
import socketserver
import os
#Create Login System at (10:30)
# Create Management Console
def Management():
commands = ["info", "exit", "openurl","restart","login"]
usr_input = input("> ")
if usr_input == commands[0]:
print("The Port Running for this server is: ", PORT)
print("The URL of the server is: ", HOST, PORT)
if usr_input == commands[1]:
exit_verify = input("Are you sure?: Y/N")
if exit_verify == "Y" or "y":
exit()
else:
print("Invalid Response...")
Management()
if exit_verify == "N" or "n":
Management()
if usr_input == commands[2]:
URL = "start"
URL = url+Address
os.system(URL)
# If cmd opens close window after opening URL
else:
Management()
if usr_input == commands[3]:
# Note to Readme as the server needs to be stored on "C:\" Directory
os.system("start F:\Python36\httpserver.py")
os.system("exit")
exit()
else:
Management()
HOST = input("Your IP Address: ")
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer((HOST, PORT), Handler)
Management()
httpd.serve_forever()