views:

172

answers:

1

I am setting up a simple test page in Python. I only have two files: .htaccess and index.py. I get a 403 Forbidden error when trying to view the page - how can I fix this?

.htaccess:

RewriteEngine On
AddHandler application/x-httpd-cgi .py
DirectoryIndex index.py

index.py:

#!/usr/bin/python
print "Content-type: text/html\n\n"
print "test"
+2  A: 

What permissions have you set on index.py (e.g. what does ls -l index.py say, if in Linux or other Unix variants)?

Alex Martelli
I have 755 for both files. Should I change it?
Yongho
Hmmm, no, rwx,rx,rx looks just right for the `.py` file (the x bits are irrelevant for .htaccess but I'm pretty sure they're not damaging). Does /usr/bin/python have the righs perms (probably it does)? Starting to look like serverfault might be a better place for you to ask this question and get better help, since it's really a system administration and configuration issue, not a programming one...
Alex Martelli