Setting up celery with django -
new celery , django, , have working demo project i'm using starting point. here's how creates celery app
# set default django settings module 'celery' program. os.environ.setdefault('django_settings_module', 'ch.settings') app = celery('ch') # using string here means worker doesn't have serialize # configuration object child processes. # - namespace='celery' means celery-related configuration keys # should have `celery_` prefix. app.config_from_object('django.conf:settings', namespace='celery') # load task modules registered django app configs. app.autodiscover_tasks()
the function binded using @app.task(bind=true)
in py file process_image
, debug_task
this command works in project
celery worker --app ch.celery_app
the test project name ch
my project name revamp , here's how implemented it
# set default django settings module 'celery' program. os.environ.setdefault('django_settings_module', 'revamp.settings') app = celery('revamp') # using string here means worker doesn't have serialize # configuration object child processes. # - namespace='celery' means celery-related configuration keys # should have `celery_` prefix. app.config_from_object('django.conf:settings', namespace='celery') # load task modules registered django app configs. app.autodiscover_tasks()
i binded full_render
but when try
samuel@samuel-pc:~/documents/code/revamp$ celery worker --app revamp.celery_app traceback (most recent call last): file "/usr/local/bin/celery", line 11, in <module> sys.exit(main()) file "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 14, in main _main() file "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 326, in main cmd.execute_from_commandline(argv) file "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 488, in execute_from_commandline super(celerycommand, self).execute_from_commandline(argv))) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 279, in execute_from_commandline argv = self.setup_app_from_commandline(argv) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 481, in setup_app_from_commandline self.app = self.find_app(app) file "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 503, in find_app return find_app(app, symbol_by_name=self.symbol_by_name) file "/usr/local/lib/python2.7/dist-packages/celery/app/utils.py", line 358, in find_app sym = imp(app) file "/usr/local/lib/python2.7/dist-packages/celery/utils/imports.py", line 101, in import_from_cwd return imp(module, package=package) file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) importerror: no module named celery_app samuel@samuel-pc:~/documents/code/revamp$ celery worker --app revamp.full_render traceback (most recent call last): ... file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) importerror: no module named full_render
something similar fails.
Comments
Post a Comment