Adding ManytoManyField breaks Django - python

In my project, I have a model, Project, that when saved creates another model, Access, which contains a manytomanyfield, access_list, where users can add other users onto their project as collaborators. It works - when I create a new project, I can add additional users into it, but if I add a 2nd user, it will no longer serve the page with the error,
Exception Value: get() returned more than one Access -- it returned 2!"
If I switch to an account I've added to the project, then add other users on with that account, they add fine and it does not break the page.
When the page breaks, it also creates an additional instance of the project on my Projects page, even though there's only one instance of the project in the database.
My code:
Models.py:
class Project(models.Model):
created_by = models.ForeignKey(User)
super(Project, self).save()
Access.objects.get_or_create(project=self)
class Access(models.Model):
project = models.ForeignKey(Project)
access_list = models.ManyToManyField(User)
pubdate = models.DateTimeField(default=timezone.now)
Views.py:
#login_required
def access(request, project_id=1):
thisuser = request.user
if Access.objects.filter(Q(access_list=thisuser) | Q(project__created_by=thisuser), project__id=project_id).exists():
accesspermission = Access.objects.filter(Q(access_list=thisuser) | Q(project__created_by=thisuser), project__id=project_id).order_by('-project__project_pubdate')[0]
else:
accesspermission = None
if Entry.objects.filter(project_id=project_id).exists():
anyentries = Entry.objects.filter(project_id=project_id, entry_unique=1).order_by('-entry_pubdate')[0]
else:
anyentries = None
if Entry.objects.filter(project_id=project_id, entry_unique=1).exists():
firstentry = Entry.objects.filter(project_id=project_id, entry_unique=1).order_by('-entry_pubdate')[0]
else:
firstentry = None
if Entry.objects.filter(project_id=project_id).exists():
lastentry = Entry.objects.filter(project_id=project_id).order_by('-entry_pubdate')[0]
lastentrynumber = lastentry.entry_unique
else:
lastentrynumber = None
if request.method == "POST":
form = AddAccessForm(request.POST)
if form.is_valid():
p = form.save(commit=False)
adduserfromform = p.accessupdate
if User.objects.filter(username=adduserfromform).exists():
usertoadd = User.objects.get(username=adduserfromform)
projecttoadd = Access.objects.filter(project__id=project_id).order_by('-project__project_pubdate')[0]
projecttoadd.access_list.add(usertoadd)
else:
usertoadd = None
removeuserfromform = p.accessremove
if User.objects.filter(username=removeuserfromform).exists():
usertoremove = User.objects.get(username=removeuserfromform)
projecttoremove = Access.objects.filter(project__id=project_id).order_by('-project__project_pubdate')[0]
projecttoremove.access_list.remove(usertoremove)
else:
usertoremove = None
form.save()
return HttpResponseRedirect('/projects/get/%s/access' % project_id)
Traceback:
Traceback (most recent call last):
File "/webapps/filmeditdb/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/webapps/filmeditdb/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/webapps/filmeditdb/filmeditdb/docproject/views.py", line 284, in access
def access(request, project_id=1):
File "/webapps/filmeditdb/local/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/webapps/filmeditdb/local/lib/python2.7/site-packages/django/db/models/query.py", line 310, in get
(self.model._meta.object_name, num))
MultipleObjectsReturned: get() returned more than one Access -- it returned 2!
2014-03-25 22:48:26 [17264] [INFO] Handling signal: winch
2014-03-25 22:48:26 [17264] [INFO] SIGWINCH ignored. Not daemonized

Adding a full traceback is generally recommeded, but from the error shown the issue is most likely on this line:
projecttoremove = Access.objects.get(project__id=project_id).order_by('-project__project_pubdate')[0]
Djangos get() always expects to return only 1 object. If there is 0 objects, it throws a DoesNotExist exception if there is more than 0, it throws MultipleObjectsReturned Exception.
Change that line to match the earlier line here:
projecttoadd = Access.objects.filter(project__id=project_id).order_by('-project__project_pubdate')[0]
Failing this, identify the erroneous call. The exception you are getting is quite clear.
At some point in the code, you are calling Access.objects.get() with some parameters and it is finding 2 objects instead of 1. Either fix the parameters, or moer likely switch it to use filter().

Related

Why is my django session not persisting? It works when I use Postman but not when I try through my Frontend

I'm currently working on a registration component for an application built using React with TypeScript and Tailwind CSS, Django and MongoDB.
In my Django backend I have an app called login_register_app, which is used for registration functionality. I want to create a session that stores the id of the document when the document is created so that when the user is asked to add further details on the following page the correct document can be updated. So far, I have the following function for registration:
#api_view(['POST'])
def create_login(request):
# parse json
body = json.loads(request.body)
# get email and password and confirm password
email = body.get('email')
password = body.get('password')
confirm_password = body.get('confirm_password')
email_is_valid = False
password_is_valid = False
error = ''
# password must be at least 8 characters and contain digit 0 - 9, Uppercase, Lowercase and Special
# character from list (#?!#$%^&*-)
password_validation_pattern = re.compile('^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!#$%^&*-]).{8,}$')
# compare password to confirm password and regex pattern
if password == confirm_password and re.match(password_validation_pattern, password):
password_is_valid = True
elif password == confirm_password:
error = 'password is not valid. Requires at least one uppercase, lowercase, digit and special character [#?!#$%^&*-]'
else:
error = 'passwords do not match'
# verify email does not already exist in the database
if not users_collection.find_one({'email': email}):
email_is_valid = True
else:
error = 'email already exists'
# hash password before storing in database
hashed_password = make_password(password)
# save to database
if email_is_valid and password_is_valid:
document = users_collection.insert_one({
'email': email,
'password': hashed_password,
})
# create session to track the user id
user_id = document.inserted_id
request.session['user_id'] = str(user_id)
print(request.session.items())
return JsonResponse(
{
'emailIsValid': email_is_valid,
'passwordIsValid': password_is_valid,
'errorMessage': error
}
)
As you can see, a session is created following the successful creation of a new document in the MongoDB database to store a session called user_id.
In the same views.py file, I have a second function responsible for dealing with the additional information the user inputs such as name, date of birth, etc. In order to correctly update the relevant document, I attempt to access the session I previously created using document = users_collection.find_one({"_id": bson.ObjectId(request.session['user_id'])}) as seen in the code below:
#api_view(['POST'])
def add_core_user_details(request):
# parse json
body = json.loads(request.body)
# get all values
first_name = body.get('first_name')
last_name = body.get('last_name')
date_of_birth = body.get('date_of_birth')
gender = body.get('gender')
phone_number = body.get('phone_number')
athlete_or_coach = body.get('athlete_or_coach')
problem = ''
error_message = ''
# verify first and surname only have alphabetic values
if len(first_name) in [0, 1]:
problem = 'First Name'
error_message = 'First name is required and must contain more than 1 character'
elif not first_name.isalpha():
problem = 'First Name'
error_message = 'First name must only contain alphabetic characters'
if len(last_name) in [0, 1]:
problem = 'Last Name'
error_message = 'Last name is required and must contain more than 1 character'
elif not last_name.isalpha():
problem = 'Last Name'
error_message = 'Last name must only contain alphabetic characters'
# convert date_of_birth to type datetime
if date_of_birth is None:
problem = 'Date of Birth'
error_message = 'Date of birth is required'
else:
date_regex_pattern = re.compile(r'^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/[0-9]{4}$')
date_format = '%d/%m/%Y'
if re.match(date_regex_pattern, date_of_birth):
date_of_birth = datetime.strptime(date_of_birth, date_format)
else:
problem = 'Date of Birth'
error_message = 'Date in invalid format, must be DD/MM/YYYY'
# check gender is either male or female
if gender not in ['Male', 'Female']:
problem = 'Gender'
error_message = 'Must be either male or female'
# parse phone number to remove any non-numeric values
phone_number = re.sub(r'[^0-9]', '', phone_number)
if len(phone_number) not in [9, 10] or phone_number[0] != '0':
problem = 'Phone Number'
error_message = 'Invalid phone number'
# check athlete or coach is either athlete, coach or both
if athlete_or_coach not in ['Athlete', 'Coach', 'Both']:
problem = 'Athlete or Coach'
error_message = 'Must be either athlete, coach or both'
print(request.session.items())
if error_message == '' and problem == '':
# save to database
document = users_collection.find_one({"_id": bson.ObjectId(request.session['user_id'])})
update = {'$set':{
'first_name': first_name,
'last_name': last_name,
'date_of_birth': date_of_birth,
'gender': gender,
'phone_number': phone_number,
'user_type': athlete_or_coach
}}
users_collection.update_one({"_id": bson.ObjectId(request.session['user_id'])}, update)
return JsonResponse({
'problem': problem,
'errorMessage': error_message
})
However, when I do this I get a KeyError suggesting that the key user_id does not exist within the session dictionary but when I check the session dictionary after initially creating the session I can see that its there as shown in the stack trace below where the session dictionary for the first API call (login-register/create-login/) in on line 1 of the stack trace and the session dictionary for the second API call (login-register/core-details/) can be seen on line 3 of the stack trace:
dict_items([('user_id', '63e0f975611b8440139c674c')])
[06/Feb/2023 12:58:29] "POST /login-register/create-login/ HTTP/1.1" 200 67
dict_items([])
Internal Server Error: /login-register/core-details/
Traceback (most recent call last):
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\django\views\generic\base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\rest_framework\decorators.py", line 50, in handler return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\login_register_app\views.py", line 175, in add_core_user_details
document = users_collection.find_one({"_id": bson.ObjectId(request.session['user_id'])})
~~~~~~~~~~~~~~~^^^^^^^^^^^
File "C:\Users\bench\Documents\GitHub\z12-performance-webapp\server\.venv\Lib\site-packages\django\contrib\sessions\backends\base.py", line 53, in __getitem__
return self._session[key]
~~~~~~~~~~~~~^^^^^
KeyError: 'user_id'
What I find to be most confusing is that when I test this functionality using Postman, it works as intended i.e. the session is stored by the first API call and is available for the second API call allowing the document to be updated correctly in the MongoDB database. But when I use my React frontend it does not work the same as shown by the stack trace above. This lead me to initially believe this to be a frontend issue however, after testing I am certain that the data is being passed correctly from the frontend to the backend.
Additionally, when I check the database via the /admin page of the django project I don't see a table for sessions.
Any help would be greatly appreciated!
I believe you're going about this the wrong way. Sessions should be tracked on the client side, not the server side. After successful registration/authentication, a token is sent in the API response which is stored in localStorage and used in following requests to identify the user. The way you're going about this now requires your Django backend to be stateful which does not follow REST architecture.
Instead, you should (ideally) use the Django authentication system to register your user and then track their progress through your form on the front-end.

Is there any way to update self.xxx in side_effect on MagicMock?

I want to test following oauth session class which update self.xxx attribute in their method.
TestSample1 mock specified method only and it works.
But, IMO, this method is too complex if use multiple attributes and methods.
I want to MagicMock to handle multiple attributes and methods without assign.
I've wrote TestSample2 and It's failed.
Is there any idea to improve TestSample1 or TestSample2?
import unittest
from unittest import mock
# ---- Main code ----
class OAuthSession():
def refresh_access_token(self):
# Some request for external API here.
self.access_token = 'refreshed new token'
def target_method(auth):
# Some check based on auth to refresh access token
if auth.a.b.c.d.e:
auth.refresh_access_token()
return auth.access_token
# ---- Test code ----
def mocked_refresh_access_token(self):
self.access_token = 'mocked refreshed token'
# Passed. but setup conditions are complex
class TestSample1(unittest.TestCase):
#mock.patch('test_sample.OAuthSession.refresh_access_token', autospec=True, side_effect=mocked_refresh_access_token)
def test_target_method(self, _):
oauth_session = OAuthSession()
oauth_session.a = mock.MagicMock()
oauth_session.a.b.c.d.e = True
oauth_session.g = mock.MagicMock()
oauth_session.g.h.i.j.k = True
result = target_method(oauth_session)
assert result == 'mocked refreshed token'
# Failed. I want to write like this.
class TestSample2(unittest.TestCase):
#mock.patch('test_sample.OAuthSession')
def test_target_method(self, _):
oauth_session = OAuthSession()
oauth_session.a.b.c.d.e = True
oauth_session.g.h.i.j.k = True
oauth_session.refresh_access_token.side_effect = mocked_refresh_access_token
result = target_method(oauth_session)
assert result == 'mocked refreshed token'
# Failed. I want to write like this also.
class TestSample3(unittest.TestCase):
def test_target_method(self):
oauth_session = mock.MagicMock()
oauth_session.a.b.c.d.e = True
oauth_session.g.h.i.j.k = True
oauth_session.refresh_access_token.side_effect = mocked_refresh_access_token
result = target_method(oauth_session)
assert result == 'mocked refreshed token'```
Errors
ERROR: test_target_method (test_sample.TestSample3)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/sheile/test_sample.py", line 59, in test_target_method
result = target_method(oauth_session)
File "/home/sheile/test_sample.py", line 15, in target_method
auth.refresh_access_token()
File "/home/sheile/.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py", line 1081, in __call__
return self._mock_call(*args, **kwargs)
File "/home/sheile/.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py", line 1085, in _mock_call
return self._execute_mock_call(*args, **kwargs)
File "/home/sheile/.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py", line 1146, in _execute_mock_call
result = effect(*args, **kwargs)
TypeError: mocked_refresh_access_token() missing 1 required positional argument: 'self'

Querying the database in a Django unit test

I am creating a web application which has a POST endpoint, that does two things:
Saves the POSTed data (a university review) in the database.
Redirects the user to an overview page.
Here is the code for it:
if request.method == 'POST':
review = Review(university=university,
user=User.objects.get(pk=1),
summary=request.POST['summary'])
review.save()
return HttpResponseRedirect(reverse('university_overview', args=(university_id,)))
I haven't yet implemented passing the user data to the endpoint, and that's why I'm saving everything under the user with pk=1.
My test is as follows:
class UniversityAddReviewTestCase(TestCase):
def setUp(self):
user = User.objects.create(username="username", password="password", email="email")
university = University.objects.create(name="Oxford University", country="UK", info="Meh", rating="9")
Review.objects.create(university=university, summary="Very nice", user_id=user.id)
Review.objects.create(university=university, summary="Very bad", user_id=user.id)
new_review = {
'summary': 'It was okay.'
}
self.response = Client().post('/%s/reviews/add' % university.id, new_review)
def test_database_updated(self):
self.assertEqual(len(Review.objects.all()), 3)
The result is this:
File ".../core/views.py", line 20, in detail
user=User.objects.get(pk=1),
File ".../ENV/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File ".../ENV/lib/python3.6/site-packages/django/db/models/query.py", line 403, in get
self.model._meta.object_name
django.contrib.auth.models.DoesNotExist: User matching query does not exist.
Why is this happening? I know the user I'm creating has a pk=1, as when I actually print it during the test it's 1.
pk is defined by the database. Something could make it not equal to 1 in your test.
Try this in your setUp method
user = User.objects.create_user(
username="username",
password="password",
email="test#example.com",
id=1
)
assert user.pk == 1
Take advantage of using self and then you can try this instead:
class UniversityAddReviewTestCase(TestCase):
def setUp(self):
self.user = User.objects.create(
username="username",
password="password",
email="email")
....
and then
if request.method == 'POST':
review = Review(
university=university,
user=self.user,
summary=request.POST['summary'])
review.save()
I could make it work, with the following lines:
import unittest # instead of (from django.test import TestCase)
class NameTest(unittest.TestCase):
#lines to test your code here...

django unit test raise AssertionError for "blank=False" field

I have a model field namely descrition and the constraints for the field is
description = models.TextField(
verbose_name=_('Description'),
help_text=_('Description of the requirement'),
blank=True, default=''
)
so it can not be blank from the form level.But i want to write a unit test for this and i have write one and its raising the error AssertionError: ValidationError not raised
My test code(please avoid the other fields and methods,i didn't mention those fields and methods in detail because they are not relevant at this moment)
class RequirementHeaderTestCase(TestCase):
def setUp(self):
self.user = Customer.objects.create_user(email="user#user.com")
self.user_id = self.user.id
self.anonymous_user_email_id = None
self.session = None
self.description = 'Test Description'
self.requirement_status = 'Complete'
self.service = RequirementService()
def test_requirement_header_without_description(self):
with self.assertRaises(ValidationError) as ex:
self.service.create_requirement_header(
user_id=self.user_id,
anonymous_user_email_id=self.anonymous_user_email_id,
session=self.session,
requirement_status=self.requirement_status,
)
self.assertEqual(ex.exception.__class__, ValidationError)
after run this test, its showing the followin error,
FAIL: test_requirement_header_without_description (requirements.tests.RequirementHeaderTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/equirements/tests.py", line 25, in test_requirement_header_without_description
requirement_status=self.requirement_status,
AssertionError: ValidationError not raised
my question ,how can i write a unit test for a field which is blank=False from the form level.
UPDATE
Here is the relevant method
def create_requirement_header(self, user_id=None,anonymous_user_email_id=None,session=None,description='',requirement_status=None):
# getting Customer object from id
user = None
if user_id is not None:
try:
user = Customer.objects.get(pk=user_id)
except Customer.DoesNotExist:
raise ObjectDoesNotExist('User was not found')
# getting AnonymousUserEmail object from id
anonymous_user_email = None
if anonymous_user_email_id is not None:
try:
anonymous_user_email = AnonymousUserEmail.objects.get(pk=anonymous_user_email_id)
except AnonymousUserEmail.DoesNotExist:
raise ObjectDoesNotExist('AnonymousUserEmail object was not found') # Need to re-think about message
requirement_header = RequirementHeader.objects.create_requirement_header(user=user,
anonymous_email=anonymous_user_email,
session=session,
description=description,
requirement_status=requirement_status)
return {
"id": requirement_header.id,
"description": requirement_header.description,
"status": requirement_header.requirement_status
}

Django celery task_id is null

I'm trying to implement a progress bar in Django, I'm taking references from this code snippet I found http://djangosnippets.org/snippets/2898/ but my efforts are in vane because I don't know what happening but the task_idfor celery is always null when executes the method task, that's my code:
def add_categoria(request):
if request.POST:
form_cat = CategoriaModelForm(request.POST,request.FILES)
if form_cat.is_valid():
file = request.FILES['imagen']
job = upload_image_categoria(request).delay()
request.session['task_id'] = job.id
return HttpResponse(json.dumps({'task_id':job.id}))
else:
return HttpResponseBadRequest(json.dumps(form_cat.errors),
mimetype="application/json")
else:
form = CategoriaModelForm()
return render_to_response("ventas/form.html",{'form':form},context_instance=RequestContext(request))
#task()
def upload_image_categoria(request):
form = CategoriaModelForm(request.POST, request.FILES)
path = MEDIA_ROOT+'/categorias/%s' % form.cleaned_data['imagen'].name
file = request.FILES['imagen']
destination = open(path, 'wb+')
porcentaje = 0
acum = 0
for chunk in file.chunks():
time.sleep(0.1)
current_task.update_state(state='PROGRESS', meta={'current': porcentaje})
acum += len(chunk)
porcentaje = int((acum*100)/file.size)
destination.write(chunk)
#csrf_exempt
def upload_state(request):
""" A view to report the progress to the user """
data = 'Fail'
if request.is_ajax():
if 'task_id' in request.POST.keys() and request.POST['task_id']:
task_id = request.POST['task_id']
task = AsyncResult(task_id)
data = task.result or task.state
else:
data = 'No task id'
else:
data = 'This is not an ajax request'
json_data = json.dumps(data)
return HttpResponse(json_data, mimetype='application/json')
So, when I report the state of progress bar in upload_image_categoria at current_task.update_state(state='PROGRESS', meta={'current': porcentaje}) always I get this Traceback:
Traceback:
File "/Users/Tone/blog-env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/Users/Tone/blog-env/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
25. return view_func(request, *args, **kwargs)
File "/Users/Tone/Documents/Proyectos/dgp/ventas/forms.py" in add_categoria
446. job = upload_image_categoria(request).delay()
File "/Users/Tone/blog-env/lib/python2.7/site-packages/celery/app/task.py" in __call__
330. return self.run(*args, **kwargs)
File "/Users/Tone/Documents/Proyectos/dgp/ventas/forms.py" in upload_image_categoria
462. current_task.update_state(state='PROGRESS',meta={'current': i, 'total': 100})
File "/Users/Tone/blog-env/lib/python2.7/site-packages/celery/app/task.py" in update_state
695. self.backend.store_result(task_id, meta, state)
File "/Users/Tone/blog-env/lib/python2.7/site-packages/celery/backends/base.py" in store_result
282. self._store_result(task_id, result, status, traceback, **kwargs)
File "/Users/Tone/blog-env/lib/python2.7/site-packages/celery/backends/amqp.py" in _store_result
128. routing_key=task_id.replace('-', ''),
Exception Type: AttributeError at /ventas/categorias/add/
Exception Value: 'NoneType' object has no attribute 'replace'
That's my settings.py for celery options:
BROKER_URL = "amqp://guest#localhost:5672//"
CELERY_IMPORTS = ("ventas.forms",)
CELERY_TRACK_STARTED = True
CELERY_RESULT_BACKEND = "amqp"
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
CELERY_RESULT_DBURI = "mysql://root#localhost/dgp"
So I don't know what's happening, worker is correctly, settings (I guess, is correctly) and always I get the same, I prove in some other projects with the same settings (this project particularly http://iambusychangingtheworld.blogspot.com.es/2013/07/django-celery-display-progress-bar-of.html) and it works perfectly so I don't know why here not, something I'm missing? Any ideas would be appreciate.
Regards!

Categories