No api proxy found for service "taskqueue"
Question: When I'm trying to `python manage.py changepassword` command I get this
errror:

    
    
    AssertionError: No api proxy found for service "taskqueue"
    

Here's what I have in my `PYTHONPATH`:

    
    
    $ echo $PYTHONPATH
    lib/:/usr/local/google_appengine
    

And my `DJANGO_SETTINGS_MODULE` points to the settings file that I use for
GAE:

    
    
    $ echo $DJANGO_SETTINGS_MODULE
    settings.dev
    

There's some package for `taskqueue` in appengine api folder:

    
    
    /usr/local/google_appengine/google/appengine/api/taskqueue$ ls
    __init__.py  __init__.pyc  taskqueue.py  taskqueue.pyc  taskqueue_service_pb.py  taskqueue_service_pb.pyc  taskqueue_stub.py  taskqueue_stub.pyc
    

What could I miss here?


Answer: I assume `manage.py` is executing sdk methods without starting a local
`dev_appserver`. `dev_appserver.py` sets up stubs to emulate the services
available once your application is deployed. When you are executing code
locally and outside of the running app server, you will need to initialize
those stubs yourself.

The app engine docs have a section on testing that tells you [how to
initialize those
stubs](https://cloud.google.com/appengine/docs/python/tools/localunittesting?hl=en#Python_Writing_task_queue_tests).
It isn't the exact solution to your issue, but it can point you to the stubs
you need to set up.

    
    
    import unittest
    
    from google.appengine.api import taskqueue
    from google.appengine.ext import deferred
    from google.appengine.ext import testbed
    
    
    class TaskQueueTestCase(unittest.TestCase):
        def setUp(self):
            self.testbed = testbed.Testbed()
            self.testbed.activate()
    
            # root_path must be set the the location of queue.yaml.
            # Otherwise, only the 'default' queue will be available.
            self.testbed.init_taskqueue_stub(root_path='tests/resources')
            self.taskqueue_stub = self.testbed.get_stub(
                testbed.TASKQUEUE_SERVICE_NAME)
    
        def tearDown(self):
            self.testbed.deactivate()
    
        def testTaskAddedToQueue(self):
            taskqueue.Task(name='my_task', url='/url/of/my/task/').add()
            tasks = self.taskqueue_stub.get_filtered_tasks()
            assert len(tasks) == 1
            assert tasks[0].name == 'my_task'
    

