0

I am trying to configure apache with mod_python to run python scripts . I have tried many different configuration but none worked . my hello.py file seems like this

  from mod_python import apache

   def handler(req):
        req.log_error('handler')
        req.content_type = 'text/html'
        req.send_http_header()
        req.write('<html><head><title>Testing mod_python</title></head> <body>')
        req.write('Hello World!')
        req.write('</body></html>')
        return apache.OK

I have placed my hello.py file in /var/www/html folder and whenever I type http://localhost/hello then 404 file not found error comes and when I type extension also in url http://localhost/hello.py then full content of hello.py file is displayed in my browser. thanks in advance.

1 Answer 1

0

See this http://webpython.codepoint.net/mod_python_publisher_apache_configuration

or

easy way to get it, create file .htaccess in your folder /var/www/html and write in file:

SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.