Ok think I've got it..

I'm now checking the sys.path for the import, now only does it once!

if not 'shared/jinja2.zip' in sys.path:
  sys.path.insert(0, 'shared/jinja2.zip')
  #print "import"



On Jan 9, 10:04 pm, Anthony <[email protected]> wrote:
> Hi, same problem here with 
> Jinja:http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> I have a main() function, but still does not look like it is caching
> (zipimported logs debug message every request), the zipimported is not
> in the file with the main() should this still cache?
>
> The structure of my app is:
>
> #main.py
> from shared import template
>
> #Hander classes  etc ..
> class Home(..):
>   def get():
>     template.render()
>
> def main():
>   etc..
>
> #shared/template.py
> sys.path.insert(0, 'shared/jinja2.zip')
> from jinja2 import Environment, FunctionLoader , TemplateNotFound
>
> def render():
>    etc..
>
> On Jan 9, 6:02 pm, Marzia Niccolai <[email protected]> wrote:
>
> > Hi Tom,
>
> > This is likely to happen if you don't have a main() function.  
> > Seehttp://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> > For information on how to troubleshoot if your app is being reloaded each
> > request.
>
> > -Marzia
>
> > On Fri, Jan 9, 2009 at 8:11 AM, Tom <[email protected]> wrote:
>
> > > What am I doing wrong?  Every call generates a high CPU call to
> > > zipimporter.  The times range from 2000 to 4500ms each time.  I am
> > > using appengine-patch.
>
> > > #
> > >   1.
> > >      01-09 08:03AM 07.774 /android/bottle/sync/ 200 1463ms 3886ms-cpu
> > > 169kb
> > >      See details
> > >      208.54.90.55 - - [09/Jan/2009:08:03:09 -0800] "POST /android/
> > > bottle/sync/ HTTP/1.1" 200 169607 - -
> > >   2.
> > >      I 01-09 08:03AM 07.898
> > >      zipimporter('/base/data/home/apps/winebythebar/
> > > 3.330582746043449707/common/zip-packages/django.zip', '')
> > > #
> > >   1.
> > >      I 01-09 07:59AM 10.768 zipimporter('/base/data/home/apps/
> > > winebythebar/3.330582746043449707/common/zip-packages/django.zip', '')
> > >      See details
> > > #
> > >   1.
> > >      01-09 07:59AM 10.651 /android/user/login/ 200 2078ms 4336ms-cpu
> > > 0kb
> > >      See details
> > >      208.54.90.71 - - [09/Jan/2009:07:59:12 -0800] "POST /android/
> > > user/login/ HTTP/1.1" 200 329 - -
> > >   2.
> > >      I 01-09 07:59AM 10.768
> > >      zipimporter('/base/data/home/apps/winebythebar/
> > > 3.330582746043449707/common/zip-packages/django.zip', '')
> > > #
> > >  1.
> > >      I 01-09 07:55AM 56.741 zipimporter('/base/data/home/apps/
> > > winebythebar/3.330560357815056688/common/zip-packages/django.zip', '')
> > >      See details
> > > #
> > >   1.
> > >      01-09 07:55AM 56.495 /android/user/login/ 200 2389ms 2019ms-cpu
> > > 0kb
> > >      See details
> > >      208.54.90.71 - - [09/Jan/2009:07:55:58 -0800] "POST /android/
> > > user/login/ HTTP/1.1" 200 229 - -
> > >   2.
> > >      I 01-09 07:55AM 56.741
> > >      zipimporter('/base/data/home/apps/winebythebar/
> > > 3.330560357815056688/common/zip-packages/django.zip', '')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to