I've been trying to configure Django-q for the first time, with Amazon SQS as a broker.
I'm using Python 2.7.11, Django 1.11.5, Django-q 0.9.2, boto3 1.5.28 and django-storages 1.4.1.
I've been already using AWS S3 and cloudfront in my Django app for a few years, so they are configured properly. I'm using S3 and cloudfront for serving media files, while django-whitenoise for serving django static files.
I've created new IAM user just for SQS and gave it AmazonSQSFullAccess
.
List of apps im using in my project (settings.py
):
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.humanize',
'django.contrib.sitemaps',
'utils',
'storages',
'my_app',
'debug_toolbar',
'widget_tweaks',
'django_q',
)
Following the Django-q documentation, I've come up to the step where I should execute this command:
python manage.py qcluster
Which gives me these errors:
pickle.PicklingError: Can't pickle <class 'boto3.resources.factory.sqs.ServiceResource'> it's not found as boto3.resources.factory.sqs.ServiceResource
and Django error as well:
raise AppRegistryNotReady(aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Which leaves me confused, I really have no idea what could be the problem..
UPDATE
This is cmd full error trace:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "just_a_path_to_my_app\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "just_a_path_to_my_app\lib\site-packages\django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "just_a_path_to_my_app\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "just_a_path_to_my_app\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "just_a_path_to_my_app\lib\site-packages\django_q\management\commands\qcluster.py", line 22, in handle
q.start()
File "just_a_path_to_my_app\lib\site-packages\django_q\cluster.py", line 54, in start
self.sentinel.start()
File "c:\python27\Lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
File "c:\python27\Lib\multiprocessing\forking.py", line 277, in __init__
dump(process_obj, to_child, HIGHEST_PROTOCOL)
File "c:\python27\Lib\multiprocessing\forking.py", line 199, in dump
ForkingPickler(file, protocol).dump(obj)
File "c:\python27\Lib\pickle.py", line 224, in dump
self.save(obj)
File "c:\python27\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\python27\Lib\pickle.py", line 425, in save_reduce
save(state)
File "c:\python27\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\python27\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "c:\python27\Lib\pickle.py", line 687, in _batch_setitems
save(v)
File "c:\python27\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\python27\Lib\pickle.py", line 568, in save_tuple
save(element)
File "c:\python27\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\python27\Lib\pickle.py", line 425, in save_reduce
save(state)
File "c:\python27\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\python27\Lib\pickle.py", line 655, in save_dict
self._batch_setitems(obj.iteritems())
File "c:\python27\Lib\pickle.py", line 687, in _batch_setitems
save(v)
File "c:\python27\Lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "c:\python27\Lib\pickle.py", line 396, in save_reduce
save(cls)
File "c:\python27\Lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "c:\python27\Lib\pickle.py", line 754, in save_global
(obj, module, name))
pickle.PicklingError: Can't pickle <class 'boto3.resources.factory.sqs.ServiceRe
source'>: it's not found as boto3.resources.factory.sqs.ServiceResource
(my_app) just_a_path_to_my_app\fakultet>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python27\Lib\multiprocessing\forking.py", line 381, in main
self = load(from_parent)
File "c:\python27\Lib\pickle.py", line 1384, in load
return Unpickler(file).load()
File "c:\python27\Lib\pickle.py", line 864, in load
dispatch[key](self)
File "c:\python27\Lib\pickle.py", line 1096, in load_global
klass = self.find_class(module, name)
File "c:\python27\Lib\pickle.py", line 1130, in find_class
__import__(module)
File "just_a_path_to_my_app\lib\site-packages\django_q\cluster.py", line 25, in <module>
import tasks
File "just_a_path_to_my_app\lib\site-packages\django_q\tasks.py", line 11, in <module>
import cluster
File "just_a_path_to_my_app\lib\site-packages\django_q\cluster.py", line 29, in <module>
from django_q.models import Task, Success, Schedule
File "just_a_path_to_my_app\lib\site-packages\django_q\models.py", line 16, in <module>
class Task(models.Model):
File "just_a_path_to_my_app\lib\site-packages\django\db\models\base.py", line 110, in __new__
app_config = apps.get_containing_app_config(module)
File "just_a_path_to_my_app\lib\site-packages\django\apps\registry.py", line 247, in get_containing_app_config
self.check_apps_ready()
File "just_a_path_to_my_app\lib\site-packages\django\apps\registry.py", line 125, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
I was unaware of the fact that django-q has Windows compatibility issues, so that was the reason why i wasn't able to make it to work under my Windows development machine. After i installed django-q on my production CentOS server and followed simple configuration instructions - everything went well.