form post to cgi exec programs (.exe)

15 skatījumi
Pāriet uz pirmo nelasīto ziņojumu

Goloka

nelasīta,
2008. gada 3. jūn. 07:22:0903.06.08
uz web2py Web Framework
Just downloaded web2py and started tinkering with it. Congratulations
to Massimo Di Pierro for his very innovative concept! This looks like
the fastest (and neatest) way to develop web database applications to
date.

Before using it for my new applications, I would like to know whether
it is possible to run my existing cgi programs as well. Specifically
whether it is possible to use web2py to set up a form to post
variables to an exe program (in cgi) and then receive the output of
that exe program in json format and display it as sortable table back
to the user?

Appreciate if somebody can give a detailed answer or point me to a
documentation url on the procedures required to call .exe cgi
programs. Thank you.

Massimo Di Pierro

nelasīta,
2008. gada 3. jūn. 08:29:5703.06.08
uz web...@googlegroups.com
Thank you. I appreciate you comments.

About your question. Yes and No.

You can run web2py on a post (say 8000) and your CGI scripts on a
different port (say 8001) using a different web server. In this case
the web2py program can call the CGI scripts pass parameters and
receive response. Example

import urllib
data=urllib.urlopen('http://localhost:8001/myscript.cgi?
parameter=value')

(you can read more in the urllib and urllib2 documentation).

You cannot call the cgi scripts from web2py without going over http.
This is not a web2py limitation, this is a CGI one. In fact CGI
assumes that every CGI script is executed in its own process and thus
has its own folder, environment variables and stdout/stdin. Therefore
a CGI script is not thread safe and cannot be executed inside a
thread (threads shares folder, environment and IO streams). web2py
uses threads.

Hope this helps.

Massimo

Atbildēt visiem
Atbildēt autoram
Pārsūtīt
0 jauni ziņojumi