Most likely it's a dumb question for those who knows the answer, but I'm a beginner, and here it goes:
I have a Python script which I run in a command-line with some parameter, and it prints me some results. Let's say results are some HTML code.
I never done any Python programming for web, and couldn't figure it out... I need to have a page (OK, I know how to upload files to a server, Apache is running, Python is installed on the server...) with an edit field, which will accept that parameter, and Submit button, and I need it to "print" the results on a web page after the user submitted a proper parameter, or show any output that in a command-line situation are printed.
I've read Dive Into Python's chapters about "HTML Processing" and "HTTP Web Services", but they do not describe what I'm looking for.
If the answer isn't short, I would very much appreciate links to the more relevant stuff to read or maybe the key words to google for it.
Sounds like you just need to enable CGI on apache, which pretty much will redirect your output to the webserver output.
Python does have CGI library you may take a look at it.
Here's an essay by Guido ( a bit dated )
And an interactive instruction that looks promising.
p.s.
Perhaps you may also want to see Google's offering for this Google app engine ( it may not be what you want though )
For such a simple task, you probably don't need more than CGI. Luckily Python has a built-in cgi
module which should do what you want.
Or you could look into some of the minimal web frameworks, such as web.py.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With