I have an application and a subapplication, and it works, except for
the render_jinja in the subapplication looks in a relative path
'templates/' from the top level application rather than the
subapplication's path (one directory down).
This seems like an expected error given the way Python's namespace
works, but has anyone figured out a workaround? I'd like to keep the
templates separate as I want the subapplication to be reusable with
other apps down the line.
Top Application:
#!/usr/bin/python
import model
import hashlib
import math
import sys
from datetime import datetime
import web
from web.contrib.template import render_jinja
from constants import *
import filemanager
auth = None
urls = (
'/admin/filemanager_iframe', filemanager.app,
(...)
app = web.subdir_application(urls, globals())
session = web.session.Session(app,
web.session.DiskStore(SESSIONS_PATH))
from forms import *
from processors import *
from helpers import *
render = render_jinja(
'templates/',
encoding = 'utf-8'
)
Subapplication:
#!/usr/bin/python
import web
import os
from web.contrib.template import render_jinja
import config
import mimetypes
from os.path import exists, join
from os import pathsep
import json
import shutil
urls = (
'/delete', 'Delete',
'/rename', 'Rename',
'/file_listing', 'FileListing',
'/copy', 'Copy',
'/media/(.*)', 'Static',
'/view/(.*)', 'View',
'/view', 'View',
'/', 'Home',
)
app = web.application(urls, globals())
render = render_jinja(
'templates/',
encoding = 'utf-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.