[mod_python] Apache1.3.33 + Python2.3.4 + mod_python - Can't get Python templates to work

Graham Dumpleton grahamd at dscpl.com.au
Wed Jan 26 06:38:41 EST 2005


On 26/01/2005, at 7:09 PM, Brandon Masterson wrote:

> Gave it a try but had no luck.  Adding something like this:
>
> filepath = "%s/basic.html" % os.path.dirname(__file__)
> templateFile = open (filepath, 'r')
>
> ...generated the same error I get if I hard coded the entire absolute 
> path in with the template name (e.g. /var/www/pythontest/basic.html).  
> When I make this change, I get the following:
>
> ERROR MESSAGE:
> 404 Not Found
> The requested URL /pythontest/c.py was not found on this server.

Read the error message. It isn't even talking about not being able to
open "basic.html". It is saying that the URL you used didn't even
map to a valid resource.

Anyway, suggest you go back to square one and create a simple test
content handler which simply returns an explicit string. Get this
working again before you even attempt to do something that opens
a file. Ie., do one step at a time. At least then you can be exactly
sure at what point things fall apart.

Also, we might be able to assist more if you provide a full copy of
the contents of the Python code file you are using rather than the
snippets you have posted so far. Also repost the Apache configuration
you are using at the same time for that Python code file. It is hard
to gauge if your content handler is even setup correctly without
complete information.

Graham



More information about the Mod_python mailing list