Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory
    text
    copied!<p>How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory</p> <p>in code.py</p> <pre><code>production=True if not production: try:web.render('mafbase.tmpl', None, True, 'mafbase') except:pass else: from templates import mafbase </code></pre> <p>in templates/mafbase.tmpl and templates/mafbase.py</p> <pre><code>try:web.render('mafbase.tmpl', None, True, 'mafbase') </code></pre> <p>This works but is very slow to load and causes timeout errors</p> <pre><code>from templates import mafbase </code></pre> <p>This doesnt work, the exception traceback is:</p> <pre><code> return self._delegate(fn, self.fvars, args) File "/home/mark/work/common/web/application.py", line 411, in _delegate return handle_class(cls) File "/home/mark/work/common/web/application.py", line 386, in handle_class return tocall(*args) File "user.py", line 262, in proxyfunc return func(self, *args, **kw) File "/home/mark/work/pop/code.py", line 1796, in GET return web.render('subclass.html') File "/home/mark/work/common/web/cheetah.py", line 104, in render return str(compiled_tmpl) File "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py", line 982, in __str__ def __str__(self): return getattr(self, mainMethName)() File "mafbase.py", line 634, in respond File "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py", line 1512, in _handleCheetahInclude nestedTemplateClass = compiler.compile(source=source,file=file) File "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py", line 693, in compile fileHash = str(hash(file))+str(os.path.getmtime(file)) File "/usr/lib/python2.5/posixpath.py", line 143, in getmtime return os.stat(filename).st_mtime OSError: [Errno 2] No such file or directory: '/home/mark/work/pop/widgetbox.html' </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload