Re: Quickest way to make py script Web accessible
Turning a script into a CGI is a brain-dead easy way of web-enabling a script. You could even make the script dual purpose by checking for the existence of CGI environment variables. If they exist the script is running as a CGI. There are lots of resources on the internet on how to write CGIs. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list
Quickest way to make py script Web accessible
What is the quickiest and easiest way to make a py script run on a Web server? I have access to an Apache Web server running on Linux. I'm often asked to run some of my scripts on behalf of others. My hope is to make a simple Web-based interface where people could run the scripts themselves whenever they like... instead of asking me. I'd rather not rewrite the scripts with PHP. Any tips on a fast, easy way of doing this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
[EMAIL PROTECTED] wrote: What is the quickiest and easiest way to make a py script run on a Web server? I have access to an Apache Web server running on Linux. I'm often asked to run some of my scripts on behalf of others. My hope is to make a simple Web-based interface where people could run the scripts themselves whenever they like... instead of asking me. I'd rather not rewrite the scripts with PHP. Any tips on a fast, easy way of doing this? Thanks! I haven't tried it myself, but have you looked into http://www.modpython.org/? -- -Todd http://www.signalsguru.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
[EMAIL PROTECTED] wrote: What is the quickiest and easiest way to make a py script run on a Web server? I have access to an Apache Web server running on Linux. I'm often asked to run some of my scripts on behalf of others. My hope is to make a simple Web-based interface where people could run the scripts themselves whenever they like... instead of asking me. Perhaps I'm not understanding the question, but .. Can you write a CGI script that calls the desired program using Python's system call, like: os.system(/home/rtilley/cleanup.py) and then returns a little HTML saying that the cleanup was done at such-and-such a time? Is that what you are asking to do? Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
Karrigell lets you run pure python scripts, although not directly in Apache. It uses its own server running behind apache. You can code in 4 styles: -pure python scripts -python in html (like in PHP) -html in python -karrigell services (mapping functions to urls) http://karrigell.sf.net Hope this helps... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
[EMAIL PROTECTED] wrote: What is the quickiest and easiest way to make a py script run on a Web server? I have access to an Apache Web server running on Linux. I'm often asked to run some of my scripts on behalf of others. My hope is to make a simple Web-based interface where people could run the scripts themselves whenever they like... instead of asking me. I'd rather not rewrite the scripts with PHP. Any tips on a fast, easy way of doing this? Thanks! If it's just using the web to *run* a python script on the server, then a simple cgi-script which will spawn a process for other scripts. You need a web form that permit the user to choose the script he/she wants executed. That form will point (action='your_cgi_script.py') to the script who's job will be to spawn the other script, submitting the user choice. One HTML page for the script choices and one extra python script to receive the cgi call, seems easy! If it doesn't look that way to you, don't hesitate to let it be known, and on which part... Jean-Marc -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
I apologize for my inital ambiguity. Say I have a .py script that gets email addresses from a database and then sends messages to customers (this is not spam, these guys _want_ to get the emails). Historically, IT has executed the script when someone in Marketing makes a request. I want to make it so that Marketing can run the script themselves by executing the script through a Web-based interface. I don't want to have to alter the script a great deal in order to do this. -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
This works well! Thanks for the advice. The docs for it should include something about adding content_type = 'text\plain' otherwise, the 'testing' section of the tutorial is broken It should look like this: from mod_python import apache def handler(req): req.content_type = 'text/plain' req.write(Hello World!) return apache.OK Not this: from mod_python import apache def handler(req): req.write(Hello World!) return apache.OK -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
Thank you all for the advice and suggestions. I appreciate the time you took to help! -- http://mail.python.org/mailman/listinfo/python-list
Re: Quickest way to make py script Web accessible
[EMAIL PROTECTED] wrote: I apologize for my inital ambiguity. Say I have a .py script that gets email addresses from a database and then sends messages to customers (this is not spam, these guys _want_ to get the emails). Historically, IT has executed the script when someone in Marketing makes a request. I want to make it so that Marketing can run the script themselves by executing the script through a Web-based interface. I don't want to have to alter the script a great deal in order to do this. I think my previous suggestion was just on the nose - none of your scripts need be modified EXCEPT if they entail user input, for which you would have to a web form to get such info from your user. and have your cgi call your mail program with the parameters submitted from the web form (such group of customers, such message, etc). An alternative to spawning a process, is importing the mail script within the cgi script itself (conditionnaly if need be). -- http://mail.python.org/mailman/listinfo/python-list