I think it's quite common for main.py (e.g.) to do a bunch of
initialization - for us, it's adjusting sys.path to include "lib"
which is full of third-party libraries.
Instead of mapping to the deferred handler directly in app.yaml, we
map it to our regular main.py:
- url: /_ah/queue/deferred
script: main.py
#script: $PYTHON_LIB/google/appengine/ext/deferred/deferred.py
login: admin
And then in main.py, we map to the deferred RequestHandler (we use
webapp):
from google.appengine.ext import deferred
...
application = webapp.WSGIApplication(
[
...
# deferred handler
('/_ah/queue/deferred', deferred.TaskHandler),
...
]
)
This allows us to get everything inflated as we expect.
It works for us; I'd love to hear from someone if this is going to
fall down for us.
j
On Dec 15, 1:13 pm, johnP <[email protected]> wrote:
> I don't know exactly the issue you are having - but I had a few
> obstacles to getting the deferred to work properly (I hope) for
> myself.
>
> 1. First, I'm using Django authentication for my application rather
> than Google auth. So when testing on devserver, I had to manually
> access _ah/login to ensure I was logged in as an administrator to test
> the tasks.
>
> 2. I was getting an intermittent error on production where the
> deferred function was hitting a new instance of my app, rather than a
> warm instance. In this case, all the appengine-patch initialization
> was being skipped. Instead of hitting an appengine-patched instance,
> a pure webapp instance was loading. To resolve this issue, I put all
> my deferred tasks into a separate module. In the module, I included
>
> import common.appenginepatch.main
>
> I don't know if this is the most efficient way to do this, but it
> works. Now on some of my deferred tasks, I see the logging.info item
> that zipimporter loaded Django. On other tasks that hit a warm
> instance, the import does not occur.
>
> So far so good.
>
> On Dec 9, 12:15 pm, drthink <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I am using app-engine-patch on my small business appointment
> > scheduling applicationwww.sohoappspot.com.
>
> > If I login and use the application then initiate some code that causes
> > the the defer library to be called, i.e. a queue task is run, this
> > messes up the main website. It is almost as if it a call to the queue
> > affects the configuration of the main website. The user then appears
> > as if they are no logged in and I get a series of errors.
>
> > Is any body else having problems using the task queue with app-engine-
> > patch?
>
> > Cheers
> > DrT
--
You received this message because you are subscribed to the Google Groups
"app-engine-patch" 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/app-engine-patch?hl=en.