2
내가 장고 1.11 프로젝트를 이름없는 :없습니다, 어떤 모듈이 같은 배치, 셀러리 3.1.25로, MyApp를
env
myproject
myapp
myotherapp
settings
settings.py
__init__.py
celery_init.py
내 __init__.py
다음이 포함
from .celery_init import app as celery_app
및 내 celery_init.py
에는 다음이 포함
from __future__ import absolute_import
import os
import sys
import traceback
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings.settings')
from django.conf import settings
app = Celery('myproject')
# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
나는 D에 대한 로컬 셀러리 노동자를 시작 갈 때 와 evelopment 테스트는,이 원인을 무엇
ImportError: No module named myapp
:
env/bin/celery worker -A myproject -l info -n [email protected]%h -Q somequeue
그것은 예외와 함께 실패? 일부 경로 문제이며 프로젝트 설정을 올바르게로드 할 수 없다고 생각되지만 구성에 문제가없는 것 같습니다. Django 1.11로 업그레이드했는데 이전 버전에서는이 설정이 정상적으로 작동했습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
나는 celery_init.py
의 끝에 인쇄 명령문을 추가하여 모든 것을로드하고 모든 줄이 오류없이 완료되도록했습니다.
전체 스택 추적을 게시 할 수 있습니까? – solarissmoke
myproject 폴더 (프로젝트 레벨 폴더가 아닌 설정 레벨)에서 명령을 실행하고 응용 프로그램이 하나에서 실행중인 경우 가상 env가 활성화되어 있는지 확인하십시오. – daemon24