Consider a simple server.py
from http.server import CGIHTTPRequestHandler, HTTPServer
PORT = 5005
handler = CGIHTTPRequestHandler
handler.cgi_directories = ['/'] # this is the current directory
server = HTTPServer(('localhost', PORT), handler)
print ('Server is ready at', PORT, 'PORT')
server.serve_forever()
If I call this file using python.exe -u server.py in command line I'll be able to serve a python script in '/' main directory.
I could use also python -m http.server --bind localhost --cgi 5005 directly.
In both cases I need to open in the browser a specific python file, lets say: http://localhost:5005/myfunction.py
Is there an alternative to include the file.py using http.server directly in command line?
For example, something equivalent to micro -p 5005 file.js according to micro npm module?
localhost:5005/(the root directory) to a file? I am unfarmiliar with whatmicrois so I have no idea what you are actually asking for...localhost:5005/to a specific file using command line.index.htmlit will automatically redirect to that.