On Mon, Oct 22, 2012 at 11:15 AM, 吕仁坤 <[email protected]> wrote:
> The following code works using the development server but not when running
> on my Apache server.
>
> render = web.template.render('templates/')
> return render.index(self)
>
> What I don't want to do is use an absolute path, because I'd like to be able
> to move my project files around without having to tinker with the code to
> keep it working.

Try this:

import os.path

root = os.path.dirname(__file__)
render = web.template.render(os.path.join(root, "templates/"))

Anand

-- 
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