Search Results

Search found 3 results on 1 pages for 'tylerw'.

Page 1/1 | 1 

  • How do I access session data in Jinja2 templates (Bottle framework on app engine)?

    - by TylerW
    Hello! I'm running the micro framework Bottle on Google App Engine. I'm using Jinja2 for my templates. And I'm using Beaker to handle the sessions. I'm still a pretty big Python newbie and am pretty stoked I got this far :) My question is how do I access the session data within the templates? I can get the session data no problem within the actual python code. And I could pass the session data each time I call a jinja template. But since I need the session data in the main menu bar of the site... that means I would have to pass it on every single page. Does anyone know if I can access it directly in the templates? For example I need the session data for my header links: Home | FAQ | Login or Home | FAQ | Logout Any help is greatly appreciated! :D

    Read the article

  • Newbie python error in regards to import

    - by TylerW
    Hello. I'm a python newbie and starting out with using the Bottle web framework on Google App Engine. I've been messing with the super small, super easy Hello World sample and have already ran into problems. Heh. I finally got the code to work with this... import bottle from bottle import route from google.appengine.ext.webapp import util @route('/hello') def hello(): return "Hello World!" util.run_wsgi_app(bottle.default_app()) My question is, I thought I could just go 'import bottle' without the second line. But if I take the second line out, I get a NameError. Or if I do 'from bottle import *', I still get the error. bottle is just a single file called 'bottle.py' in my site's root directory. So neither of these work.... import bottle from google.appengine.ext.webapp import util @route('/hello') def hello(): return "Hello World!" util.run_wsgi_app(bottle.default_app()) Or from bottle import * from google.appengine.ext.webapp import util @route('/hello') def hello(): return "Hello World!" util.run_wsgi_app(bottle.default_app()) The error message I get is... Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3180, in _HandleRequest self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3123, in _Dispatch base_env_dict=env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 515, in Dispatch base_env_dict=base_env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2382, in Dispatch self._module_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2292, in ExecuteCGI reset_modules = exec_script(handler_path, cgi_path, hook) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2188, in ExecuteOrImportScript exec module_code in script_module.dict File "/Users/tyler/Dropbox/sites/dietgrid/code2.py", line 4, in @route('/hello') NameError: name 'route' is not defined So am I wrong in thinking it should be able to work the other ways or no?

    Read the article

  • Trying to figure out URL dispatcher for sluggale URLs like stackoverflow

    - by TylerW
    I'm using the Tornado framework (Python). I have the sluggable URLs working. But I have 3 different entries in the URL dispatcher. I was wondering if someone could help me transform it into one line. This is what I have: (r"/post/([0-9]+)/[a-zA-Z0-9\-]+", SpotHandler), (r"/post/([0-9]+)/", SpotHandler), (r"/post/([0-9]+)", SpotHandler), I want it so that the following URLs all go to the same place. http://domain.com/post/14 http://domain.com/post/14/ http://domain.com/post/14/any-text-it-doesnt-matter-what-it-is

    Read the article

1