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 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.

Reply via email to