Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

celery-django can't find settings

I have a Django project that uses Celery for running asynchronous tasks. I'm doing my development on a Windows XP machine.

Starting my Django server (python manage.py runserver 80) works fine, but attempting to start the Celery Daemon (python manage.py celeryd start) fails with the following error:

ImportError: Could not import settings 'src.settings' (Is it on sys.path? Does it have syntax errors?): No module named src.settings

sys.path includes 'C:\development\SpaceCorps\src', so I'm not sure why it can't find this module.

Here's the full output from starting the daemon:

C:\development\SpaceCorps\src>python manage.py celeryd start
[2010-07-23 18:29:31,456: WARNING/MainProcess] ?[1;33mcelery@mike-laptop v2.0.1 is starting.?[0m
[2010-07-23 18:29:31,456: WARNING/MainProcess] ?[1;33mC:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\bin\celeryd.py:206: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in a production environment!
  warnings.warn("Using settings.DEBUG leads to a memory leak, "?[0m
[2010-07-23 18:29:31,456: WARNING/MainProcess] ?[1;33mConfiguration ->
    . broker -> amqp://guest@localhost:5672/
    . queues ->
    . celery -> exchange:celery (direct) binding:celery
    . concurrency -> 2
    . loader -> djcelery.loaders.DjangoLoader
    . logfile -> [stderr]@WARNING
    . events -> OFF
    . beat -> OFF?[0m
[2010-07-23 18:29:31,706: WARNING/MainProcess] ?[1;33mcelery@mike-laptop has started.?[0m
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Program Files\Python26\lib\multiprocessing\forking.py", line 342, in main
    self = load(from_parent)
  File "C:\Program Files\Python26\lib\pickle.py", line 1370, in load
    return Unpickler(file).load()
  File "C:\Program Files\Python26\lib\pickle.py", line 858, in load
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    dispatch[key](self)
  File "C:\Program Files\Python26\lib\pickle.py", line 1090, in load_global
  File "C:\Program Files\Python26\lib\multiprocessing\forking.py", line 342, in main
    self = load(from_parent)
  File "C:\Program Files\Python26\lib\pickle.py", line 1370, in load
    klass = self.find_class(module, name)
  File "C:\Program Files\Python26\lib\pickle.py", line 1124, in find_class
    return Unpickler(file).load()
  File "C:\Program Files\Python26\lib\pickle.py", line 858, in load
    dispatch[key](self)
  File "C:\Program Files\Python26\lib\pickle.py", line 1090, in load_global
    __import__(module)
  File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\concurrency\processes\__init__.py", line 7, in <module>
    from celery import log
  File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\log.py", line 8, in <module>
    from celery import conf
  File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\conf.py", line 118, in <module>
    ALWAYS_EAGER = _get("CELERY_ALWAYS_EAGER")
  File "C:\Program Files\Python26\lib\site-packages\celery-2.0.1-py2.6.egg\celery\conf.py", line 109, in _get
    value = getattr(settings, alias)
  File "c:\development\django\django\utils\functional.py", line 276, in __getattr__
    self._setup()
  File "c:\development\django\django\conf\__init__.py", line 40, in _setup
    self._wrapped = Settings(settings_module)
  File "c:\development\django\django\conf\__init__.py", line 75, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'src.settings' (Is it on sys.path? Does it have syntax errors?): No module named src.settings
like image 248
MikeWyatt Avatar asked Jul 23 '10 23:07

MikeWyatt


1 Answers

Apparently this is a problem with running Celery on Windows. Using the --settings argument ala python manage.py celeryd start --settings=settings did the trick.

like image 156
MikeWyatt Avatar answered Oct 23 '22 23:10

MikeWyatt