Hi,

You are missing this stanza from the end of your handler script:

if __name__ == '__main__':
  main()

This instructs Python to execute your main function on initial import.

-Nick Johnson

On Thu, Jul 14, 2011 at 11:01 AM, piased <[email protected]> wrote:

> Hello All,
>
> I have a simple app which requires login. But instead of redirect the
> user directly to google login I have a link on my main page for Sign
> In. This page is generated as follows:
>
> class Login(webapp.RequestHandler):
>  # GET /login
>  def get(self):
>    user = users.get_current_user()
>    if not user:
>      self.response.out.write("Not signed in ")
>      self.response.out.write('<a href="%s">Sign In</a>' %
> (users.create_login_url('/')))
>    else:
>      self.response.out.write('Hello, %s ' % (user.nickname()))
>      self.response.out.write('<a href="%s">Sign Out</a>' %
> (users.create_logout_url('/')))
>
>
> So the response is pretty small, a few bytes. But if I do a wget to
> the above link it give zero bytes in response the first time I fetch
> it, on subsequent tries is works fine.
>
> From the logs I see the following message in the first request
> """
> This request caused a new process to be started for your application,
> and thus caused your application code to be loaded for the first time.
> This request may thus take longer and use more CPU than a typical
> request for your application.
> """
> Whereas there is no such message in the second request which works.
>
> Is there something I am missing or is appengine trying to do something
> for small responses and screwing up especially for new instances ?
>
> I would appreciate any help.
>
> Thanks
> -- Pranav
>
> P.S.
>
> Here are the headers for the zero byte response:
> HTTP request sent, awaiting response...
>  HTTP/1.0 200 OK
>  Date: Thu, 14 Jul 2011 00:25:29 GMT
>  Content-Type: text/html
>  Server: Google Frontend
>  Content-Length: 0
>  Connection: Keep-Alive
> Length: 0 [text/html]
>
> --
> 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.
>
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine

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