Dave Brondsema - 2021-08-26

Hi,

taskd makes a "Request" object and runs it through a turbogears wsgi app. This is so that all code can use variables like app_globals (g), tmpl_context (c), request, etc whether the code runs in a web request or a task. This starts here:

    r = Request.blank(request_path,
                      base_url=tg.config['base_url'].rstrip(
                          '/') + request_path,
                      environ={'task': self.task,
                               'nocapture': self.options.nocapture,
                               })
    list(wsgi_app(r.environ, start_response))

And wsgi_app ends up using the [app:task] section from your .ini file, which is probably like this:

[app:task]
use = main
; TurboGears will use controllers/task.py as root controller
override_root = task

So task.py's TaskController is what is supposed to finally run the task.

I haven't tried the proxy-prefix, so I'm not real sure what its implications are. But I would try putting logging in TaskController.__call__ to see if its executing at all. Probably not. The log output with the 404 error means that its not finding the TaskController.

My guess is the /my-site prefix is extra or missing, when running tasks. So some ideas you could try:

  • prepend /my-site to base_url in the Request.blank object. Or remove it if its already part of the base_url
  • add the filter-with to the [app:task] section too. Or remove it if you have it there already
  • do some debugging in def make_app where it handles the override_root setting and make sure its finding and loading TaskController as the root