Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在任务处理者worker一端加以下几句如何理解 #3

Open
scjmanbuman opened this issue Sep 12, 2019 · 0 comments
Open

在任务处理者worker一端加以下几句如何理解 #3

scjmanbuman opened this issue Sep 12, 2019 · 0 comments

Comments

@scjmanbuman
Copy link

你好,

我这边环境是windows server ,如何理解下面的注释呢?
目前我注册没有响应, 单独跑task.py 出错

django环境的初始化,在任务处理者worker一端加以下几句

import os

import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dailyfresh.settings')

django.setup()

C:\python37\python.exe C:/Users/Administrator/dailyfresh-B2C-master/dailyfresh/celery_tasks/tasks.py
Traceback (most recent call last):
File "C:/Users/Administrator/dailyfresh-B2C-master/dailyfresh/celery_tasks/tasks.py", line 15, in
from apps.goods.models import GoodsType, IndexGoodsBanner, IndexPromotionBanner, IndexTypeGoodsBanner
File "C:\Users\Administrator\dailyfresh-B2C-master\dailyfresh\apps\goods\models.py", line 3, in
from db.base_model import BaseModel
File "C:\Users\Administrator\dailyfresh-B2C-master\dailyfresh\db\base_model.py", line 12, in
class BaseModel(models.Model):
File "C:\python37\lib\site-packages\django\db\models\base.py", line 103, in new
app_config = apps.get_containing_app_config(module)
File "C:\python37\lib\site-packages\django\apps\registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "C:\python37\lib\site-packages\django\apps\registry.py", line 134, in check_apps_ready
settings.INSTALLED_APPS
File "C:\python37\lib\site-packages\django\conf_init_.py", line 79, in getattr
self.setup(name)
File "C:\python37\lib\site-packages\django\conf_init
.py", line 64, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Process finished with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant