django celery Received unregistered task of type 'print_test'
<p>In continuity with the question: <a href="https://stackoverflow.com/questions/40839324/celery-periodic-tasks-not-executing">celery periodic tasks not executing</a></p>

<p>I have set up django with celery like:</p>

<p>drf_project/drf_project/celery.py</p>

<pre><code>from __future__ import absolute_import, unicode_literals
from celery import Celery
import os

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drf_project.settings')
app = Celery('drf_project')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
</code></pre>

<p>In drf_project/drf_project/init.py</p>

<pre><code>from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app

__all__ = ['celery_app']
</code></pre>

<p>drf_project/user_management/tasks.py</p>

<pre><code>from drf_project.celery import app
from time import strftime

@app.task
def print_test():
    print strftime('%Y-%m-%d %H:%M:%S')
    with open('abc.txt', 'ab+') as test_file:
        test_file.writeline(strftime('%Y-%m-%d %H:%M:%S'))
</code></pre>

<p>In drf_project/drf_project/settings.py</p>

<pre><code>INSTALLED_APPS += ('django_celery_beat',)
CELERYBEAT_SCHEDULE = {
    "test_1": {
        "task": "tasks.print_test",
        "schedule": timedelta(seconds=2),
    },
}
</code></pre>

<p>I ran both celery worker and beat in different terminals with commands:</p>

<pre><code>celery -A drf_project worker -l info -E
</code></pre>

<p>and</p>

<pre><code>celery -A drf_project beat -l info -S django
</code></pre>

<p>The beat is sending tasks to worker every 2 seconds like:</p>

<blockquote>
  <p>[2016-11-28 12:25:19,314: INFO/MainProcess] Scheduler: Sending due task Importing contacts (print_test)</p>
</blockquote>

<p>But the worker throws the error like:</p>

<blockquote>
  <p>[2016-11-28 12:24:57,551: ERROR/MainProcess] Received unregistered task of type 'print_test'.
  The message has been ignored and discarded.</p>
  
  <p>Did you remember to import the module containing this task?
  Or maybe you're using relative imports?</p>
  
  <p>Please see
  <a href="http://docs.celeryq.org/en/latest/internals/protocol.html" rel="nofollow noreferrer">http://docs.celeryq.org/en/latest/internals/protocol.html</a>
  for more information.</p>
  
  <p>The full contents of the message body was:
  u'[[], {}, {"chord": null, "callbacks": null, "errbacks": null, "chain": null}]' (77b)
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer/consumer.py", line 549, in on_task_received
      strategy = strategies[type_]
  KeyError: 'print_test'</p>
</blockquote>

<p>I can see the task in my worker app like:</p>

<pre><code>[tasks]
  . user_management.tasks.print_test
</code></pre>

<p>How to solve this error?</p>