It's not clear that the app cache expects only one main() per app.  I
think that the documentation says that it will cache a main() for each
handler.

http://code.google.com/appengine/docs/python/tools/configuration.html#Script_Handlers
says that that an application can have multiple handlers.

http://code.google.com/appengine/docs/python/runtime.html#App_Caching
says: "If a handler script provides a main() routine, the runtime
environment also caches the script."  Note - "a handler".

Given those two sections, I suspect that the app cache will save a main
() for each handler.

Perhaps someone from Google will comment.

On Mar 27, 1:19 pm, cz <[email protected]> wrote:
> The problem with the app.yaml solution is that only the handler that
> has a main() will be cached (I assume that the app cache expects just
> one main() per app). It would be possible to perform a dispatch in main
> () to different handlers but it gets a little more messy since you
> would have to do this before referencing or loading any frameworks
> (unless the handlers all share the same framework in which case this
> discussion is moot).
> From what I understand, versions can have arbitrary names (not just
> numbers) so versions are, in a sense, just different apps that share
> quotas and datastore. Only the default can be associated with a Google
> app domain though. Otherwise the version name is basically another
> kind of app name, which makes it possible to have multiple main()'s
> and a mix of frameworks that can be optimized for certain kinds of
> requests. It also makes the code a little more straightforward...
> - Claude
>
> On Mar 26, 11:46 pm, Robert <[email protected]> wrote:
>
>
>
> > Hi,
>
> > you could also in your app.yaml simply define a dedicated/different
> > handler for e.g. those images as they presumably are all under another
> > URL. Then you don't need to think/worry so much about different
> > versions.
>
> > Just my 2cts.
>
> > Robert
>
> > On Mar 27, 12:50 am, "Tom M." <[email protected]> wrote:
>
> > > A very clever solution.
>
> > > On Mar 26, 6:31 pm, cz <[email protected]> wrote:
>
> > > > Awesome, thanks Jeff. I think doing it this way would make my app use
> > > > less resources in general which is good for everybody.
> > > > - Claude
>
> > > > On Mar 26, 2:25 pm, Jeff S <[email protected]> wrote:
>
> > > > > Hi Claude,
>
> > > > > On Mar 25, 8:27 pm, cz <[email protected]> wrote:
>
> > > > > > The reason I ask this is for the following scenario:
> > > > > > My main app uses Django 1.x and has fairly low, but quite useful ;),
> > > > > > traffic thus often requiring a cold start. It incurs significant
> > > > > > startup time and so the initial requests are quite slow. The pages
> > > > > > also contain lots of images uploaded by users which in turn are
> > > > > > initially very slow to serve up.
> > > > > > What I'd like to do is use a lighter weight framework just to serve
> > > > > > images and other pseudo-static content. It would be fairly
> > > > > > straightforward to simply create a special version of the app that
> > > > > > when installed has direct access to the same datastore and can be 
> > > > > > very
> > > > > > fast. This wouldn't ever be set as the default version of course, 
> > > > > > but
> > > > > > would still be 'a part of' the default app and it would be using the
> > > > > > same quota bank and hopefully wouldn't be a violation of the TOS.
> > > > > > Anways, after reading the TOS I couldn't find an answer to this.
>
> > > > > > So, in case none of this makes much sense the gist of the question 
> > > > > > is
> > > > > > can I have two versions of the app live at the same time (only one
> > > > > > being the default)?
> > > > > > Say my app id is 'foo'. I upload 'foo' version 5 and then I also
> > > > > > upload a 'foo' version 6 with a different main.py and code that is
> > > > > > optimized for a specific kind of content (eg. images, no templates).
> > > > > > Version 5 is set as the default but generates pages with image urls
> > > > > > that point to version 6.
>
> > > > > This would be fine since you are talking about using two versions
> > > > > under the same app ID. Quotas are applied based on the app ID (not
> > > > > further down on the version level), so sending traffic to multiple
> > > > > versions would be pulling from the same quota pool.
>
> > > > > Good question,
>
> > > > > Jeff
>
> > > > > > Can I do this under the TOS and still be a good GAE citizen?
>
> > > > > > thanks,
> > > > > > - Claude- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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