cgi

In my Python CGI script, how do I save to disk a file uploaded via POST request of data entered by the user in a form?

筅森魡賤 提交于 2019-12-08 07:50:41
问题 The client has a simple form that takes a text and a file: <form name="add_show" id="add_show" action="" method="GET"> <label class="text-info">Show Name:</label> <input type="text" id="show_name" name="show_name" placeholder="My Show Name" required><br><br> <label class="text-info">Show's File (JSON):</label> <input type="file" id="file" name="file" required><br><br> <p><input class="btn btn-danger btn-small" name="button2" value="Add the Show!" onClick="addFullShow(this.form)"></p> </form>

How to override @INC settings in httpd.conf on OSX

余生长醉 提交于 2019-12-08 03:06:18
问题 How can I set where Perl looks for modules in Apache httpd.conf file on OSX? I've installed several modules via CPAN, which were installed successfully in /opt/local/lib/perl5/site_perl/5.8.9 I can verify this via perldoc perllocal If I run perl -V on the command line, I get (among other dirs): @INC: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9 When I run a perl script as CGI via Apache, however, I get errors that the modules I'm use ing can not be

“…/auto/List/Util/Util.so: undefined symbol: PL_stack_sp at …/XSLoader.pm” only when running test suite with CGI::Test _and_ on Travis CI

♀尐吖头ヾ 提交于 2019-12-08 02:56:42
问题 I have a Perl module called CGI::Github::Webhook whose test suite works fine on Travis CI so far on the branch master. But since it's a module for writing CGI scripts, I wanted to test it with CGI::Test as this would be closer to real-life scenarios. But every Travis CI run in the branch cgi-test failed so far. Except for the runs with Perl 5.24 and above, every failed run contained these lines, just with different Perl version numbers in the paths: Attempt to reload List/Util.pm aborted.

Use virtualenv in python script

主宰稳场 提交于 2019-12-08 01:59:54
问题 I've set up a virtualenv in my working directory and I installed matplotlib in this environment. Now I want to use this virtualenv for a script that I've written. #!venv/bin/python import matplotlib.pyplot as plt Without the import command, it works, but I get "ImportError: No module named matplotlib.pyplot". Edit: I use mod_cgi. 回答1: Did you install matplotlib into your venv? venv/bin/pip install numpy venv/bin/pip install matplotlib Other than that, there is nothing wrong with your script.

Tornado or Django works with CGI?

南笙酒味 提交于 2019-12-08 01:48:00
问题 Tornado is a webserver + framework like Django but for real-time features. On my server I don't have a python module or wsgi module so I thought CGI. Is there a way to get Tornado ( or Django ) works by using CGI folder ? If yes, Could you explain me how do I do that ? 回答1: flup provides a CGI-to-WSGI adapter, but you really should consider using something like FastCGI instead. 回答2: Main feature of Tornado is that it is high performance web-server written in Python, for creating web

500 internal server error when importing a python module in wsgi

心不动则不痛 提交于 2019-12-08 01:26:22
问题 I've got a Python script that is executing functions asynchronously by using PEST wsgi library. However, when I try to import another module it simply results in a 500 error. The way I try to reference it is: from foo import * from foo import Foo where foo is a file .py in which I have the object that I want to reference to. Tried to monitor the calls through Chrome's Inspect Element Control but couldn't find a thing. Also tried to debug using Apache's error log, but nothing there. Any hints

Does Google App Engine actually implement “normal” CGI?

僤鯓⒐⒋嵵緔 提交于 2019-12-07 23:58:12
问题 The main documentation pages claim that it does: "The Python 2.7 runtime supports the WSGI standard and the CGI standard for backwards compatibility." This must then be a very obvious problem, but I can't figure it out. I'm new to Google App Engine and am trying to use it to run an old Python CGI app. I've installed the SDK on my Linux system and have an app.yaml file that says this: application: your-app-id version: 3 runtime: python27 api_version: 1 threadsafe: false handlers: - url: /.*

Streaming stdout to a web page

萝らか妹 提交于 2019-12-07 22:13:28
问题 This seems like it should be a really simple thing to achieve, unfortunately web development was never my strong point. I have a bunch of scripts, and I would like to launch them from a webpage and see the realtime stdout text on the page. Some of the scripts take a long time to run so the normal single response isn't good enough (I have this working already). As far as I can see, my options are stdout to a file, and periodically (every couple of seconds) send a request from the client and

Running a Python CGI Script with Sudo Privileges on the Apache Server

老子叫甜甜 提交于 2019-12-07 19:30:03
问题 I am new to python CGI using Ubuntu 12.04 on the Apache 2.2.22 http server. I am writing a script that will create other python scripts. These created scripts must have "chmod +x" permissions to execute. The script creating scripts must provide these permissions and I cannot figure out how to get it to do this. In the code that creates the file, I am curious about this: os.system('sudo chmod +x %s.py' %(fname)) This is what attempts give the created file "chmod +x" permissions. The os.system

Python CGI os.system causing malformed header

久未见 提交于 2019-12-07 18:50:52
问题 I am running Apache/2.4.10 (Raspbian) and I am using python for CGI. But when I try to use os.system in simple code I get this malformed header error: [Wed Aug 31 17:10:05.715740 2016] [cgid:error] [pid 3103:tid 1929376816] [client 192.168.0.106:59277] malformed header from script'play.cgi': Bad header: code.cgi Here is the code from play.cgi: #!/usr/bin/python # -*- coding: UTF-8 -*- import cgi import os print('Content-type: text/html') print('') os.system('ls') The strange thing is that if