Note that there are some explanatory texts on larger screens.

plurals
  1. POmod_python with apache2, (Re)importing module error
    primarykey
    data
    text
    <p>I'm trying to get mod-python to work with apache2 but not having any success. I've followed a few tutorials for getting mod-python working but I can't see what I'm doing wrong. </p> <p>When I visit <a href="http://site.example.com/cgi-bin/test.py" rel="nofollow noreferrer">http://site.example.com/cgi-bin/test.py</a> I actually get my 404 page! (whereas I get a 403 forbidden if the file really doesn't exist)</p> <p>Here's my setup:</p> <p>In /etc/apache2/sites-enabled/ there are configuration files named after each of my domains. In <a href="http://dpaste.com/hold/21618/" rel="nofollow noreferrer">the site.example.com file</a> I've added this to the user directives section:</p> <pre><code># Begin user directives &lt;-- &lt;Directory /home/default/site.example.com/user/htdocs/cgi-bin/&gt; Options Indexes FollowSymLinks MultiViews AllowOverride AuthConfig Order allow,deny allow from all AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On &lt;/Directory&gt; # --&gt; End user directives </code></pre> <p>full file <a href="http://dpaste.com/hold/21618/" rel="nofollow noreferrer">here</a>, which includes the line:</p> <p><strong>EDIT</strong> to add contents of test.py:</p> <pre><code>#!/usr/bin/python print "Content-type: text/html" print print 'hello world' #print 1/0 </code></pre> <p>As shown above, I get a <code>404 /python/test.py was not found on this server</code>.</p> <p>But if I uncomment the last line I get:</p> <pre><code>Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch result = object(req) File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 98, in handler path=[path]) File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 457, in import_module module = imp.load_module(mname, f, p, d) File "/home/default/site.example.co.uk/user/htdocs/python/test.py", line 5, in ? print 1/0 ZeroDivisionError: integer division or modulo by zero </code></pre> <p>Does this traceback look right? Enabling cgitb has no effect by the way.</p> <p>Is there any other info I can add to help diagnose this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload