[google-appengine] Re: Error caused by webapp2.uri_for
Check and see if you have had a deadline exceeded error during instance startup, prior to the instance exhibiting this problem. T On Wednesday, January 15, 2014 11:06:55 PM UTC+8, Jeff Potter wrote: I am having this problem with coto-boilerplate right now. Stacktrace for the problem below. Stopping and starting a new instance fixes the problem. Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template(_filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return self.environment.handle_exception(exc_info, True) File boilerplate/templates/home.html, line 1, in top-level template code {% extends base_layout %} File boilerplate/templates/base.html, line 40, in top-level template code File boilerplate/templates/home.html, line 6, in block canonical {% block canonical %}{{ uri_for(home) }}{% endblock %} UndefinedError: 'uri_for' is undefined uri_for is defined in basehandler.py like so def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables. 'csrf_token': generate_csrf_token, 'uri_for': webapp2.uri_for, 'getattr': getattr, }) j.environment.tests.update({ # Set test. # ... }) return j All the routes work perfectly fine until the instance gets into a funky state where no uri_for call works (seen it for other uris as well). any ideas? On Monday, July 16, 2012 12:34:35 AM UTC-7, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
[google-appengine] Re: Error caused by webapp2.uri_for
I am not seeing any deadline exceeded error during the instance startup, but I was able to successfully reproduce this problem, steps below. 1. Make sure no server instances are started in GAE (shutdown any already running) 2. Go to a page that does not exist in the app (i.e. www.my-app.com/this-page-will-never-exist) 3. Returns a 'Error 404: The resource could not be found' as expected. Logs also show that this request caused a new process to be started as expected. 4. /taskqueue-send-mail/ is kicked off to send the admin an error email ('send_mail_developer': True in config.py) 5. Now go to any valid page on the app and I get Error 500: 'uri_for' is undefiend *If the first request (which starts a new server instance) is a valid page, then this error goes away.* I did the same steps above but between number 1 and 2 I went to a valid page. I then went to an invalid page and got the 404, but after that I did not get any 'uri_for' undefined error. Any ideas? Thanks, Jeff On Thursday, January 16, 2014 4:21:11 AM UTC-8, timh wrote: Check and see if you have had a deadline exceeded error during instance startup, prior to the instance exhibiting this problem. T On Wednesday, January 15, 2014 11:06:55 PM UTC+8, Jeff Potter wrote: I am having this problem with coto-boilerplate right now. Stacktrace for the problem below. Stopping and starting a new instance fixes the problem. Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template(_filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return self.environment.handle_exception(exc_info, True) File boilerplate/templates/home.html, line 1, in top-level template code {% extends base_layout %} File boilerplate/templates/base.html, line 40, in top-level template code File boilerplate/templates/home.html, line 6, in block canonical {% block canonical %}{{ uri_for(home) }}{% endblock %} UndefinedError: 'uri_for' is undefined uri_for is defined in basehandler.py like so def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables. 'csrf_token': generate_csrf_token, 'uri_for': webapp2.uri_for, 'getattr': getattr, }) j.environment.tests.update({ # Set test. # ... }) return j All the routes work perfectly fine until the instance gets into a funky state where no uri_for call works (seen it for other uris as well). any ideas? On Monday, July 16, 2012 12:34:35 AM UTC-7, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to
[google-appengine] Re: Error caused by webapp2.uri_for
Hi I would look at how you 404 handler is initialized and if it has different imports/initialization phases to your regular handler. My guess is something isn't being imported correctly. Are you using appengine_config.py for all your path setups and any global init ? T On Friday, January 17, 2014 1:55:52 AM UTC+8, Jeff Potter wrote: I am not seeing any deadline exceeded error during the instance startup, but I was able to successfully reproduce this problem, steps below. 1. Make sure no server instances are started in GAE (shutdown any already running) 2. Go to a page that does not exist in the app (i.e. www.my-app.com/this-page-will-never-exist) 3. Returns a 'Error 404: The resource could not be found' as expected. Logs also show that this request caused a new process to be started as expected. 4. /taskqueue-send-mail/ is kicked off to send the admin an error email ('send_mail_developer': True in config.py) 5. Now go to any valid page on the app and I get Error 500: 'uri_for' is undefiend *If the first request (which starts a new server instance) is a valid page, then this error goes away.* I did the same steps above but between number 1 and 2 I went to a valid page. I then went to an invalid page and got the 404, but after that I did not get any 'uri_for' undefined error. Any ideas? Thanks, Jeff On Thursday, January 16, 2014 4:21:11 AM UTC-8, timh wrote: Check and see if you have had a deadline exceeded error during instance startup, prior to the instance exhibiting this problem. T On Wednesday, January 15, 2014 11:06:55 PM UTC+8, Jeff Potter wrote: I am having this problem with coto-boilerplate right now. Stacktrace for the problem below. Stopping and starting a new instance fixes the problem. Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template(_filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return self.environment.handle_exception(exc_info, True) File boilerplate/templates/home.html, line 1, in top-level template code {% extends base_layout %} File boilerplate/templates/base.html, line 40, in top-level template code File boilerplate/templates/home.html, line 6, in block canonical {% block canonical %}{{ uri_for(home) }}{% endblock %} UndefinedError: 'uri_for' is undefined uri_for is defined in basehandler.py like so def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables. 'csrf_token': generate_csrf_token, 'uri_for': webapp2.uri_for, 'getattr': getattr, }) j.environment.tests.update({ # Set test. # ... }) return j All the routes work perfectly fine until the instance gets into a funky state where no uri_for call works (seen it for other uris as well). any ideas? On Monday, July 16, 2012 12:34:35 AM UTC-7, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2
[google-appengine] Re: Error caused by webapp2.uri_for
Below is the log data from the 404 error Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1265, in default_dispatcher route, args, kwargs = rv = self.match(request) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1214, in default_matcher raise exc.HTTPNotFound() HTTPNotFound: The resource could not be found. Never gets out of the webapp2.py to start anything. Any idea on what needs to be done? On Thursday, January 16, 2014 3:41:39 PM UTC-8, timh wrote: Hi I would look at how you 404 handler is initialized and if it has different imports/initialization phases to your regular handler. My guess is something isn't being imported correctly. Are you using appengine_config.py for all your path setups and any global init ? T On Friday, January 17, 2014 1:55:52 AM UTC+8, Jeff Potter wrote: I am not seeing any deadline exceeded error during the instance startup, but I was able to successfully reproduce this problem, steps below. 1. Make sure no server instances are started in GAE (shutdown any already running) 2. Go to a page that does not exist in the app (i.e. www.my-app.com/this-page-will-never-exist) 3. Returns a 'Error 404: The resource could not be found' as expected. Logs also show that this request caused a new process to be started as expected. 4. /taskqueue-send-mail/ is kicked off to send the admin an error email ('send_mail_developer': True in config.py) 5. Now go to any valid page on the app and I get Error 500: 'uri_for' is undefiend *If the first request (which starts a new server instance) is a valid page, then this error goes away.* I did the same steps above but between number 1 and 2 I went to a valid page. I then went to an invalid page and got the 404, but after that I did not get any 'uri_for' undefined error. Any ideas? Thanks, Jeff On Thursday, January 16, 2014 4:21:11 AM UTC-8, timh wrote: Check and see if you have had a deadline exceeded error during instance startup, prior to the instance exhibiting this problem. T On Wednesday, January 15, 2014 11:06:55 PM UTC+8, Jeff Potter wrote: I am having this problem with coto-boilerplate right now. Stacktrace for the problem below. Stopping and starting a new instance fixes the problem. Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template(_filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return self.environment.handle_exception(exc_info, True) File boilerplate/templates/home.html, line 1, in top-level template code {% extends base_layout %} File boilerplate/templates/base.html, line 40, in top-level template code File boilerplate/templates/home.html, line 6, in block canonical {% block canonical %}{{ uri_for(home) }}{% endblock %} UndefinedError: 'uri_for' is undefined uri_for is defined in basehandler.py like so def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables.
[google-appengine] Re: Error caused by webapp2.uri_for
So that part of it looks fine. The question is does your code that initialises the globals 'globals': { 'uri_for' : webapp2.uri_for }, ever get called when it goes through this path, and if it doesn't maybe what is happening is webapp2 is now initialised (partly) in the 404 handler and not completing this initialisation correctly. Hence the error. I have never used webapp or webapp2 or jinja so I have no personal experience in this area, but the symptons really look like an incomplete initialisation. T On Friday, January 17, 2014 12:28:41 PM UTC+8, Jeff Potter wrote: Below is the log data from the 404 error Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1265, in default_dispatcher route, args, kwargs = rv = self.match(request) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1214, in default_matcher raise exc.HTTPNotFound() HTTPNotFound: The resource could not be found. Never gets out of the webapp2.py to start anything. Any idea on what needs to be done? On Thursday, January 16, 2014 3:41:39 PM UTC-8, timh wrote: Hi I would look at how you 404 handler is initialized and if it has different imports/initialization phases to your regular handler. My guess is something isn't being imported correctly. Are you using appengine_config.py for all your path setups and any global init ? T On Friday, January 17, 2014 1:55:52 AM UTC+8, Jeff Potter wrote: I am not seeing any deadline exceeded error during the instance startup, but I was able to successfully reproduce this problem, steps below. 1. Make sure no server instances are started in GAE (shutdown any already running) 2. Go to a page that does not exist in the app (i.e. www.my-app.com/this-page-will-never-exist) 3. Returns a 'Error 404: The resource could not be found' as expected. Logs also show that this request caused a new process to be started as expected. 4. /taskqueue-send-mail/ is kicked off to send the admin an error email ('send_mail_developer': True in config.py) 5. Now go to any valid page on the app and I get Error 500: 'uri_for' is undefiend *If the first request (which starts a new server instance) is a valid page, then this error goes away.* I did the same steps above but between number 1 and 2 I went to a valid page. I then went to an invalid page and got the 404, but after that I did not get any 'uri_for' undefined error. Any ideas? Thanks, Jeff On Thursday, January 16, 2014 4:21:11 AM UTC-8, timh wrote: Check and see if you have had a deadline exceeded error during instance startup, prior to the instance exhibiting this problem. T On Wednesday, January 15, 2014 11:06:55 PM UTC+8, Jeff Potter wrote: I am having this problem with coto-boilerplate right now. Stacktrace for the problem below. Stopping and starting a new instance fixes the problem. Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template(_filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return
Re: [google-appengine] Re: Error caused by webapp2.uri_for
I get the same problem (UndefinedError: 'uri_for' is undefined) with my coto-boilerplate website. It happens on the first uri_for call in a template. I had canonical links in the header which called uri_for but caused errors so I removed them, but now the errors are happening in my navbar html. uri_for is defined in basehandler.py like so: def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables. 'csrf_token': generate_csrf_token, 'uri_for': webapp2.uri_for, 'getattr': getattr, }) j.environment.tests.update({ # Set test. # ... }) return j The error happens randomly, but pretty much kills the instance until I restart. Here is a stack trace from the error when uri_for was used in a canonical link. File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/ boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site1/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/ boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template( _filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/ versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return self.environment.handle_exception(exc_info, True) File boilerplate/templates/home.html, line 1, in top-level template code {% extends base_layout %} File boilerplate/templates/base.html, line 40, in top-level template code File boilerplate/templates/home.html, line 6, in block canonical {% block canonical %}{{ uri_for(home) }}{% endblock %} UndefinedError: 'uri_for' is undefined On Tuesday, January 14, 2014 12:13:42 AM UTC-8, Roninio wrote: Vinny, Thanks for your answer. I have looked into the suggestion but can find difference with my code. I get the error only when i upload a new code to the app engine. If i restarted it manually it works. Error 500: 'uri_for' is undefined any ideas? Thanks On Tuesday, January 14, 2014 6:14:17 AM UTC+2, Vinny P wrote: On Sun, Jan 12, 2014 at 4:30 AM, Ronen Azachi aza...@gmail.com wrote: having same problem. I am using the boilerplate https://github.com/coto/gae-boilerplate; did you resolve this issue? On Monday, July 16, 2012 10:34:35 AM UTC+3, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined The fix is to insert *uri_for* as a global in some manner. There's many ways to do this, but you can try the strategy outlined here: http://stackoverflow.com/questions/7081250/webapp2-jinja2-how-can-i-get-uri-for-working-in-jinja2-views - -Vinny P Technology Media Advisor Chicago, IL App Engine Code Samples: http://www.learntogoogleit.com -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
[google-appengine] Re: Error caused by webapp2.uri_for
I am having this problem with coto-boilerplate right now. Stacktrace for the problem below. Stopping and starting a new instance fixes the problem. Traceback (most recent call last): File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1529, in __call__ rv = self.router.dispatch(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1278, in default_dispatcher return route.handler_adapter(request, response) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 1102, in __call__ return handler.dispatch() File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 88, in dispatch webapp2.RequestHandler.dispatch(self) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 572, in dispatch return self.handle_exception(e, self.app.debug) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py, line 570, in dispatch return method(*args, **kwargs) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/handlers.py, line 1526, in get return self.render_template('home.html', **params) File /base/data/home/apps/s~site/1-1.373006929445588669/boilerplate/lib/basehandler.py, line 320, in render_template self.response.write(self.jinja2.render_template(filename, **kwargs)) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2_extras/jinja2.py, line 158, in render_template return self.environment.get_template(_filename).render(**context) File /base/data/home/runtimes/python27/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py, line 894, in render return self.environment.handle_exception(exc_info, True) File boilerplate/templates/home.html, line 1, in top-level template code {% extends base_layout %} File boilerplate/templates/base.html, line 40, in top-level template code File boilerplate/templates/home.html, line 6, in block canonical {% block canonical %}{{ uri_for(home) }}{% endblock %} UndefinedError: 'uri_for' is undefined uri_for is defined in basehandler.py like so def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables. 'csrf_token': generate_csrf_token, 'uri_for': webapp2.uri_for, 'getattr': getattr, }) j.environment.tests.update({ # Set test. # ... }) return j All the routes work perfectly fine until the instance gets into a funky state where no uri_for call works (seen it for other uris as well). any ideas? On Monday, July 16, 2012 12:34:35 AM UTC-7, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
[google-appengine] Re: Error caused by webapp2.uri_for
I am having the same problem with a gae-boilerplate site. ur_for is defined in basehandler.py as so... def jinja2_factory(app): j = jinja2.Jinja2(app) j.environment.filters.update({ # Set filters. # ... }) j.environment.globals.update({ # Set global variables. 'csrf_token': generate_csrf_token, 'uri_for': webapp2.uri_for, 'getattr': getattr, }) j.environment.tests.update({ # Set test. # ... }) return j The error occurs randomly, but once it occurs the site is down for good. Re-uploading to GAE fixes the problem temporarily. On Sunday, January 12, 2014 2:30:25 AM UTC-8, Ronen Azachi wrote: hi having same problem. I am using the boilerplate https://github.com/coto/gae-boilerplate; did you resolve this issue? On Monday, July 16, 2012 10:34:35 AM UTC+3, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
Re: [google-appengine] Re: Error caused by webapp2.uri_for
Vinny, Thanks for your answer. I have looked into the suggestion but can find difference with my code. I get the error only when i upload a new code to the app engine. If i restarted it manually it works. Error 500: 'uri_for' is undefined any ideas? Thanks On Tuesday, January 14, 2014 6:14:17 AM UTC+2, Vinny P wrote: On Sun, Jan 12, 2014 at 4:30 AM, Ronen Azachi aza...@gmail.comjavascript: wrote: having same problem. I am using the boilerplate https://github.com/coto/gae-boilerplate; did you resolve this issue? On Monday, July 16, 2012 10:34:35 AM UTC+3, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined The fix is to insert *uri_for* as a global in some manner. There's many ways to do this, but you can try the strategy outlined here: http://stackoverflow.com/questions/7081250/webapp2-jinja2-how-can-i-get-uri-for-working-in-jinja2-views - -Vinny P Technology Media Advisor Chicago, IL App Engine Code Samples: http://www.learntogoogleit.com -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
Re: [google-appengine] Re: Error caused by webapp2.uri_for
On Tue, Jan 14, 2014 at 2:13 AM, Roninio azac...@gmail.com wrote: I have looked into the suggestion but can find difference with my code. I get the error only when i upload a new code to the app engine. If i restarted it manually it works. Usually the fix outlined in the Stack Overflow link above fixes the problem. Since you're using GAE-Boilerplate, you may want to file an issue in their issue tracker and see if they can reproduce the problem. - -Vinny P Technology Media Advisor Chicago, IL App Engine Code Samples: http://www.learntogoogleit.com -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
[google-appengine] Re: Error caused by webapp2.uri_for
hi having same problem. I am using the boilerplate https://github.com/coto/gae-boilerplate; did you resolve this issue? On Monday, July 16, 2012 10:34:35 AM UTC+3, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
Re: [google-appengine] Re: Error caused by webapp2.uri_for
On Sun, Jan 12, 2014 at 4:30 AM, Ronen Azachi azac...@gmail.com wrote: having same problem. I am using the boilerplate https://github.com/coto/gae-boilerplate; did you resolve this issue? On Monday, July 16, 2012 10:34:35 AM UTC+3, Thomas Marban wrote: Ever since including webapp2.uri_for in my webapp2_extras.jinja2 config via 'globals': { 'uri_for' : webapp2.uri_for }, I'm getting an undefined error every time I change a python file and load the app for the first time. It won't come up on subsequent requests. Also tried to inject it into globals via a Jinja2 factory but same result. Any hints? UndefinedError: 'uri_for' is undefined The fix is to insert *uri_for* as a global in some manner. There's many ways to do this, but you can try the strategy outlined here: http://stackoverflow.com/questions/7081250/webapp2-jinja2-how-can-i-get-uri-for-working-in-jinja2-views - -Vinny P Technology Media Advisor Chicago, IL App Engine Code Samples: http://www.learntogoogleit.com -- You received this message because you are subscribed to the Google Groups Google App Engine group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.