Bottle.py caching templates despite being in debug mode

69 views
Skip to first unread message

arkanciscan via StackOverflow

unread,
Apr 22, 2012, 11:35:04 AM4/22/12
to google-appengin...@googlegroups.com

I just built my first Bottle.py app on GAE. It's working except that when I change the templates I have to restart the dev server to see the changes. The docs say that template caching is supposed to be disabled when bottle.debug(True), and that you can call bottle.TEMPLTE.clear() as well, but neither of those work. I also tried setting run(reloader=True) but that causes an error. What am I doing wrong? Does bottle.debug() work for anyone else on GAE?

import bottle
bottle.debug(True)
bottle.TEMPLATES.clear()

@bottle.route('/')
def index(name='World'):
    return bottle.template('main')

bottle.run(server='gae')

Update: Instead of using bottle.run(server='gae'), I included the standard main() function myself and now it works.

def main():
  app = bottle.default_app()
  util.run_wsgi_app(app)

if __name__ == "__main__":
  main()


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/9073645/bottle-py-caching-templates-despite-being-in-debug-mode

BOYPT via StackOverflow

unread,
Apr 22, 2012, 11:35:06 AM4/22/12
to google-appengin...@googlegroups.com

The standard method introduced by Bottle/GAE doc is:

app = bottle.app()

then invoke dev_appserver.py, it reads app.yaml and import your app from the script you defined, and handle everything else for a GAE environment.

You shouldn't run your .py directly. Running from the bottle way will skip those handles from dev_appserver, including the template cached mechanism. Of course, using the util from Google does trick way and works, but according to uwsgi or other wsgi related projects' documents, the app variable in the script module is the object should be offered for the upper handling.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/9073645/bottle-py-caching-templates-despite-being-in-debug-mode/10269289#10269289
Reply all
Reply to author
Forward
0 new messages