2

i was going to make a simple web interface for a Python script / module I am working on. I figured to submit the form which would do 1 of 2 options. Modify a config json file and run the python script, or submit a form to the python script and execute it.

Simply put, i know when working with some other applications, Apache for example, you need to configure it such that it accepts .py files as executable. Is that the same case with SimpleHTTPServer? If so, how?

I was looking at: https://docs.python.org/2/library/simplehttpserver.html

I was also looking at BaseHTTPServer at https://docs.python.org/2/library/basehttpserver.html#BaseHTTPServer.BaseHTTPRequestHandler though nothing was jumping out at me during configuration

Fallenreaper
  • 10,222
  • 12
  • 66
  • 129

1 Answers1

1

you can enable the CGI (Common Gateway Interface https://en.wikipedia.org/wiki/Common_Gateway_Interface ) of the SimpleHTTPServer, see the following thread How to host python cgi script with `python -m SimpleHTTPServer 8000` or `python -m CGIHTTPServer 8000`?

this is similar to get Django running ( https://en.wikipedia.org/wiki/Django_(web_framework) ) . Django is enabled using the mod_wsgi module or FastCGI on a WSGI-compatible webserver (Apache,...).

Community
  • 1
  • 1
ralf htp
  • 9,149
  • 4
  • 22
  • 34
  • oh. thats good to know. I was looking at the cgi a bit, but was not sure as to the extent i wanted to look into it more. That looks like it just might do the trick. – Fallenreaper Apr 03 '17 at 17:58