469,625 Members | 1,078 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

Embeded Python in Apache2 not doing its job

6
Hi,

I'm new to both Python and Apache so sorry for any upcoming
dummy questions :)

I'm running Linux (Ubuntu 6.10) and have installed the following:
- Apache 2.0.55
- Python 2.4.4c1
- libapache2-mod-python

One thing I'm still not clear about is if mod-python and CGI scripts are
the same thing or not ? Because I think I've got it all mixed up. I don't
think that mod-python is really needed to run python scripts or am I
wrong ?

Anyways, in /etc/apache2/apache2.conf I have the following lines
AddHandler cgi-script .py
<Directory /var/www>
AddHandler mod_python .py
</Directory>

In the directory /var/www I have 2 files htmlgen.py and mypage.html

File: htmlgen.py
------------------------
import cgi

print "Content-type: text/html\n\n"
print "Testing..."

File mypage.html
--------------------------
<form action="htmlgen.py" method="post">
<input type="submit" value="Test">
</form>

Now when I open mypage.html I get a button saying "Test". When I press this button Firefox wants to download the file called htmlgen.py. Why? Apache is not running the file, just sending it.

I hope someone can help me. I've read all documentation I could find but don't know what is wrong.

Best Regards
/P
Dec 8 '06 #1
0 907

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Ad Astra | last post: by
3 posts views Thread by Krzysztof Drozd | last post: by
reply views Thread by Kurt B. Kaiser | last post: by
3 posts views Thread by rmompo | last post: by
1 post views Thread by Gowri | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.