Just starting with the simplest of examples to use templates I get the
following error. Has anyone else seen this and can explain what is going on?
python app.py
Traceback (most recent call last):
File "app.py", line 7, in <module>
render = web.template.render('templates/')
File "/Library/Python/2.6/site-packages/web/template.py", line 1028, in
__init__
self.mod = __import__(name, None, None, ['x'])
ImportError: No module named templates
My app.py looks like this:
import web
urls = (
'/', 'index'
)
app = web.application(urls, globals())
render = web.template.render('templates/')
class index:
def GET(self):
name = 'Bob'
return render.index(name)
if __name__ == "__main__":
app.run()
I have a sub-directory called templates with a file index.html in it.
The index.html file looks like:
$def with (name)
$if name:
I just wanted to say <em>hello</em> to $name.
$else:
<em>Hello</em>, world!
Thanks,
Brad
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/q116C-QjosUJ.
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.