当我把我的项目投入生产时,即使使用runserver测试,这个错误也没有引发,但是当我使用gunicorn—bind进行测试时,这种情况发生
import操作系统从芹菜导入芹菜
# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sqh.settings.dev')
app = Celery('sqh',broker_url = 'redis://localhost:6379/0')
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task modules from all registered Django apps.
app.autodiscover_tasks()
#@app.task(bind=True)
#def debug_task(self):
# print(f'Request: {self.request!r}')
importterror: cannot import name芹菜
修改模块名称。例如:celery_module.py