[mod_python] Problem with mod_python and send data with a form

David Bizier dbizier at gecko-electronic.com
Fri Aug 18 10:45:08 EDT 2006


Hi,

I'm a beginner with mod_python and Python (also with english langage,
sorry). I tried some exemple code and all works fine!

Unfortunately, I have a problem to send data with a form (POST ou GET) to a
.py script file. When I try to send data to my .py file, with Firefox, I see
a blank page, without text or error message.

Here is my form (export.php):

------------------
<html>
   <body>
  <FORM name="frm1" action="scripts/python/toto.py/say" method="POST">
    <TABLE>
      <TR>
        <TD>First Name: </TD>
        <TD><INPUT type="text" name="firstname" value="Bob"></TD>
      </TR>
      <TR>
        <TD colspan="2" align="center"><INPUT type="submit" value="Go"></TD>
      </TR>
    </TABLE>
  </FORM>
   </body>
</html>
--------------------

And here is my python page (toto.py):

-------------------
from mod_python import apache
from mod_python import util

def say(req, firstname="NOTHING"):
     req.content_type = "text/html"
     return "I am saying %s" % firstname
-------------------

I have found a apache config file, on my server, with these lines:

        "...
        <IfModule mod_python.c>
        <Files ~ (\.py$)>
                SetHandler python-program
                PythonHandler   mod_python.cgihandler
        </Files>
        </IfModule>

        "...'

        </Directory>

        <Directory /var/www/vhosts/monSiteWeb.com/httpdocs/scripts/python>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride All
                AddHandler mod_python .py
                PythonHandler mod_python.publisher
                PythonDebug On
        </Directory>

Thanks for your help! I would like to find an answer shortly to continue my
project!

Regards,
David

 



More information about the Mod_python mailing list