django-cloud-tasks
django-cloud-tasks copied to clipboard
Trouble getting the quickstart example to work.
When I run the quickstart example, I get the following error:
'tuple' object has no attribute 'get'
in relating to this line in base.py: self._task_handler_url = task_handler_url or DCTConfig.task_handler_root_url()
Would it be possible to work on this together? I'm really keen to get something working to use cloud tasks with django. Many thanks!
Exactly the same message for me! (Python 3.7 / Dango 2.2.4)
That's because in the example, it says to add to settings.py the dictionary called DJANGO_CLOUD_TASKS, And after this dictionary there is a comma which makes it a tuple. Remove the comma and you'll be able to continue.
Another thing that is not documented is that you also need to have the following key in your settings.py: DJANGO_CLOUD_TASKS_HANDLER_SECRET = 'some_secret_key' This value will be added to the task and when it needs to run it, the code will validate that it's the same value that is defined in your settings. This is to somehow prevent other tasks getting into your queue. Without this key - you'll just see the tasks keep retrying, and if you'll look at the logs, you'll see it complains about 'API key mismatch'.
Anyone, please email to a repository owner to merge the pull request.
Thank you
Another thing that is not documented is that you also need to have the following key in your settings.py: DJANGO_CLOUD_TASKS_HANDLER_SECRET = 'some_secret_key' This value will be added to the task and when it needs to run it, the code will validate that it's the same value that is defined in your settings. This is to somehow prevent other tasks getting into your queue. Without this key - you'll just see the tasks keep retrying, and if you'll look at the logs, you'll see it complains about 'API key mismatch'.
That thing was really painful for me until saw your comment dude. You are really an angel... Repository owner must write about that in instructions.
Im getting some trouble too when i run the task im getting this error
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://cloudtasks.googleapis.com/v2beta3/projects/%7Bdeployement-test%7D/locations/europe-west1/queues/default/tasks?alt=json returned "Permission denied on resource project {deployement-test}.". Details: "[{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developer console API key', 'url': 'https://console.developers.google.com/project/{deployement-test}/apiui/credential'}]}, {'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'CONSUMER_INVALID', 'domain': 'googleapis.com', 'metadata': {'consumer': 'projects/{deployement-test}', 'service': 'cloudtasks.googleapis.com'}}]">
reason : 'CONSUMER_INVALID' maybe its related too DJANGO_CLOUD_TASKS_HANDLER_SECRET , i try to add it but i dont know if im doing it with the correct way , and from where i can get it