Django Apps aren't loaded yet Celery Tasks
<p>What is giving the error below? I'm unsure if this is a problem with an app I have installed or one of mine. The exception below is generated only when running Celery i.e. <code>celery -A demo.apps.wall.tasks worker</code> , runserver does not generate any errors. Which app ios the issue?</p>

<pre><code>Traceback (most recent call last):
  File "/Users/user/Documents/workspace/demo-api/env/bin/celery", line 11, in &lt;module&gt;
    sys.exit(main())
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/__main__.py", line 30, in main
    main()
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/bin/celery.py", line 81, in main
    cmd.execute_from_commandline(argv)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/bin/celery.py", line 770, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/bin/base.py", line 309, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/bin/base.py", line 469, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/bin/base.py", line 489, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/app/utils.py", line 238, in find_app
    sym = imp(app)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
    return imp(module, package=package)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 673, in _load_unlocked
  File "&lt;frozen importlib._bootstrap_external&gt;", line 662, in exec_module
  File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed
  File "/Users/user/Documents/workspace/demo-api/demo/apps/Walls/tasks.py", line 14, in &lt;module&gt;
    from demo.apps.Walls.redis_models import WallSchedule, WallBroadcast, UserWalls
  File "/Users/user/Documents/workspace/demo-api/demo/apps/Walls/redis_models.py", line 12, in &lt;module&gt;
    from demo.apps.memberships.models import Membership
  File "/Users/user/Documents/workspace/demo-api/demo/apps/memberships/models.py", line 4, in &lt;module&gt;
    from django.contrib.contenttypes.models import ContentType
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/django/contrib/contenttypes/models.py", line 161, in &lt;module&gt;
    class ContentType(models.Model):
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/Users/user/Documents/workspace/demo-api/env/lib/python3.5/site-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
</code></pre>

<p>Running <code>manage.py check</code> is ok.</p>

<p>Try adding this to the beginning of <code>tasks.py</code>:</p>

<pre><code>import django
django.setup()
</code></pre>

python django celery