LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Python CGI-Bin Scripts (https://www.linuxquestions.org/questions/linux-server-73/python-cgi-bin-scripts-613741/)

chaney44145 01-15-2008 11:28 AM

Python CGI-Bin Scripts
 
I have Fedora 6 running Apache/PHP/MySQL and Python 2.5.
I can make a web page that submits data to a Python app and it works, see below.
Web form.
<form name="form1" id="form1" method="post" action="/cgi-bin/software_proc_codes.py">

Python code.
#!/usr/bin/python
import cgi
print "Content-Type: text/plain"
print "Hello, world"

The problem I am having is how to call a compiled Python code.

I have tried changing the web form to call
/cgi-bin/software_proc_codes.pyc and failed.

I have removed the "#!/usr/bin/python" from the script, compiled and tried the following.
#!/usr/bin/python
import /var/www/cgi-bin/hello.pyc

Do I need to set something up in Apache to handle .pyc?

indienick 01-15-2008 11:44 AM

Check out the mod_cgi module in httpd.conf.
I haven't used Apache in a while, and I can't recall how you configure module behaviours. I use Lighttpd at home, and I everything is just handled in the lighttpd.conf file.


All times are GMT -5. The time now is 07:47 AM.