Hi, all.

I use Apache(2.2.3) + mod_wsgi + webpy(0.3) + Mako, but failed to use
Mako template. How can i solve this issue?
(apache + mod_wsgi + webpy setup please refer to my cookbook page:
http://webpy.org/cookbook/mod_wsgi-apache)

----8<--------------
#!/usr/bin/env python
# encoding: utf-8

import web
from web.contrib.template import render_mako

urls = (
    '/', 'SiteIndex',
)

render = render_mako(
        directories=['templates'],
        input_encoding='utf-8',
        output_encoding='utf-8',
        )

class SiteIndex:
    def GET(self):
        #return "Success." # It works.
        return render.index(**locals())

application = web.application(urls, globals(),
autoreload=True).wsgifunc()
----8<--------------

Template file: templates/index.html

----8<--------------
<h1>Site index page.</h1>
----8<--------------

I got error msg in Apache errog log:

----8<--------------
# tail -0f /var/log/httpd/error_log
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1] Traceback
(most recent call last):
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 205, in wsgi
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     result =
self.handle_with_processors()
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 177, in
handle_with_processors
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
process(self.processors)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 172, in process
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
p(lambda: process(processors))
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 524, in
processor
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
handler()
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 172, in <lambda>
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
p(lambda: process(processors))
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 172, in process
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
p(lambda: process(processors))
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 524, in
processor
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
handler()
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 172, in <lambda>
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
p(lambda: process(processors))
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 174, in process
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
self.handle()
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 166, in handle
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
self._delegate(fn, self.fvars, args)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 342, in
_delegate
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
handle_class(cls)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/application.py", line 317, in
handle_class
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
tocall(*args)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/var/
www/rhmsadmin/code.py", line 21, in GET
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     return
render.index(name=name)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/web/contrib/template.py", line 87, in
__getattr__
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     t =
self._lookup.get_template(path)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]   File "/usr/
lib/python2.4/site-packages/Mako-0.2.1-py2.4.egg/mako/lookup.py", line
72, in get_template
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]     raise
exceptions.TopLevelLookupException("Cant locate template for uri '%s'"
% uri)
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]
TopLevelLookupException: Cant locate template for uri 'index.html'
[Sat Jun 21 21:56:22 2008] [error] [client 192.168.122.1]
----8<--------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to