CGI & Python -
Here's my problem ... I have a dragon script, which is executed once from the command line, required operation Does and comes out. If, during execution, the program does not make any choice, then it prompts the user and asks them to make a decision! Now I have to implement a web interface, and here are the problems ... I created an HTML file with a simple file, once the user "submits" it then sends the parameters to the CGC script, in which only one Row and My Python Program! And it seems to work ... my question is: If this happens then the program needs to ask the user for an alternative, how can I return this value to my dragon script! To give an indication to the user for any option, I need to create a webpage with possible options ... does anyone know how I can open a webpage with Python? The second and most important question is: How do I return my "original" python module from a web page? In the dragon, I just create
return options
, but with a web page I do not know how to do this !!
Recap: 1. Getting started from a web page, I will run a CGI script! This CGI script runs my Python program ... Full
If the program is not enabled
-
To make a decision,
Create a web page with 3 possible options, I can do it
3b created web page display ????????
Return 3c responce to the original Pyhon module ????????
Thanks in advance
" I know how can I open a webpage with Python? The second and most important question is: How can I return a value from a web page "Basic" Python module ??
All is very simple.
However, you need to read that the web is actually you need to read on the web server, browser and HTTP protocol.
< P> here The Golden Rule is: A web server responds to HTTP requests with a web page.The second part of that rule is: A request is a URL and a method (GET or Post). is more for a request, but this is an important part.
All that ever happens, therefore, you have to re-use the case of your usage again .
The person clicks the bookmark; the browser makes a blank request ("/" A URL) and fills to get a form
individual form, click on the button; Browser Post Request (url in form) and one of two things is received.
-
If your script works, then get their page which says that all this work is done.
-
If your script information is required, then they get another form.
The person fills in the form, clicks on the button; A request for a browser post (URL in the form) and the final page that says that all do all the work.
You can do all this "CGI" script using Mod_wsgi and plug your stuff into Apache web server.
Or, you can get a web framework. Django, TurboGears, web.py, etc. You will be happy with a framework, though you feel that your operation is simple.
Comments
Post a Comment