Is there any way to get a twisted webserver to execute a python file like cgi on a conventional webserver? So, when i navigated to a directory, i could execute python within a seperate file?
I have created a basic webserver, but it only returns static content like text or HTML files:
from twisted.web.server import Site
from twisted.web.static import File
from twisted.internet import reactor
resource = File('/root')
factory = Site(resource)
reactor.listenTCP(80, factory)
reactor.run()
I understand why it may not be possible, but i couldn't find any documentation. Thanks
EDIT: I found a solution. Instead of going through the hassle of directories, i'm simply parsing GET requests and treating them like fake files. The CGI is executed within the main file.
THanks