cgi

Is it possible to stream output from a python subprocess to a webpage in real time?

北城以北 提交于 2019-12-03 04:49:29
Thanks in advance for any help. I am fairly new to python and even newer to html. I have been trying the last few days to create a web page with buttons to perform tasks on a home server. At the moment I have a python script that generates a page with buttons: (See the simplified example below. removed code to clean up post) Then a python script which runs said command and outputs to an iframe on the page: (See the simplified example below. removed code to clean up post) This does output the entire finished output after the command is finished. I have also tried adding the -u option to the

POST data to Python CGI script via jQuery AJAX

梦想的初衷 提交于 2019-12-03 03:47:28
I'm trying to setup a simple script where some data is sent using the jQuery .ajax function to a Python CGI script. The Python script would just make the data posted to it uppercase, and then return that data to the HTML file, where a div would be updated with the content. I have the code shown below. When I run it, the AJAX call executes, but the div is not updated with the content. the div is not updated with the data being sent. How would I modify this code so that it updates with the data being sent? I appreciate any help at all. My HTML Code: <!DOCTYPE html> <html> <head> <meta http-equiv

sys_get_temp_dir in shared hosting environment

本秂侑毒 提交于 2019-12-03 03:45:41
问题 Note: This could also fit in superuser. I am setting up PHP 5.3.10 on a shared host with apache2 mpm itk and open_basedir in a way, that each user may not see or change the files of another user. In the apache2 vhost settings, I add the appropriate entries to restrict the user: AssignUserId userA userA php_admin_value open_basedir /home/userA/www/ php_admin_value upload_tmp_dir /home/userA/www/tmp/ php_admin_value session.save_path /home/userA/www/tmp/ SetEnv TMPDIR /home/userA/www/tmp/ Now,

How can I improve Moose performance in non-persistent CGI processes?

眉间皱痕 提交于 2019-12-03 03:36:10
Moose is a fantastic object framework. The trouble is that, taken together with its dependencies, it's very big. Our profiling indicates that on our platform, simply loading Moose will incur a 5-6 second overhead on non-persistent CGI application scripts. That's just not acceptable for these one-off applications. By contrast, when we're using a persistent process system (such as FCGI), this startup overhead is eliminated (or rather, only incurred once), and all is well. The problem we have is that we can't guarantee that all of our code will always run under a persistent process. We

Why avoid CGI for Python with LAMP hosting?

一曲冷凌霜 提交于 2019-12-03 03:13:48
问题 I have been using PHP for years. Lately I've come across numerous forum posts stating that PHP is outdated , that modern programming languages are easier, more secure, etc. etc. So, I decided to start learning Python . Since I'm used to using PHP, I just started building pages by uploading an .htaccess file with: addtype text/html py addhandler cgi-script .py Then, my sample pages look like: #!/usr/bin/python print "content-type: text/html\n\n" print "html tags, more stuff, etc." This works

Apache (2) throws “No such file or directory: exec of &#039;/usr/lib/cgi-bin/fst.cgi&#039; failed”

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working in Ubuntu 10.10 (Maverick Meerkat) and running my CGI script under Apache , but it is showing me the following error... [Sat errorNo such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed [Sat Oct 22 02:56:45 2011] [error] [client 127.0.0.1] Premature end of script headers: fst.cgi My script is #!/usr/bin/perl print "Content-type:text/html\n\n"; print "hello world"; I have set the permissions of the file... I have also added the following line in file apache.conf : ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory

POST data to Python CGI script via jQuery AJAX

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to setup a simple script where some data is sent using the jQuery .ajax function to a Python CGI script. The Python script would just make the data posted to it uppercase, and then return that data to the HTML file, where a div would be updated with the content. I have the code shown below. When I run it, the AJAX call executes, but the div is not updated with the content. the div is not updated with the data being sent. How would I modify this code so that it updates with the data being sent? I appreciate any help at

mod_wsgi, mod_python, or just cgi?

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been playing around with my own webserver (Apache+Ubuntu) and python. From what I've seen there are 3(?) main ways of doing this: Apache configured to handle .py as cgi Apache configured to use mod_python that is now outdated(?) Apache configured to use mod_wsgi I recall reading that Django prefers mod_wsgi, and I'm kinda interested in learning Django (I've heard their official tutorial is rather excellent). What is the 'recommended' setup? I presume there's really no reason to use mod_python anymore, but what are the differences

mod_wsgi, mod_python, or just cgi?

时光毁灭记忆、已成空白 提交于 2019-12-03 02:36:31
问题 I've been playing around with my own webserver (Apache+Ubuntu) and python. From what I've seen there are 3(?) main ways of doing this: Apache configured to handle .py as cgi Apache configured to use mod_python that is now outdated(?) Apache configured to use mod_wsgi I recall reading that Django prefers mod_wsgi, and I'm kinda interested in learning Django (I've heard their official tutorial is rather excellent). What is the 'recommended' setup? I presume there's really no reason to use mod

Perl CGI with HTTP Status Codes

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following validation in a CGI script that will check for the GET method and return a 405 HTTP status code if the GET method is not used. Unfortunately it is still returning a 200 Status OK when using POST or PUT. my ($buffer); # Read in text $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; } else { $cgi->$header->status('405 Method Not Allowed') print $cgi->header('text/plain'); } I am still new to CGI programming so I figured someone here could toss me a bone about