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.
import os, django, csv
from products.models import *
from users.models import *
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"readme.settings",
)
django.setup()
csv 파일을 넣기 위한 db_uploader.py 작성중에 발생한 에러
다음과 같이 import 문의 위치만 조정하여 해결
import os, django, csv
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"readme.settings",
)
django.setup()
from products.models import *
from users.models import *
'dev > error' 카테고리의 다른 글
unit test 중 401 unauthorized 에러 발생 (0) | 2022.03.21 |
---|---|
django.db.utils.IntegrityError: (1452, 'Cannot add or update a child row (0) | 2022.03.20 |
[git]fatal: The current branch feature/models has no upstream branch. (0) | 2022.03.07 |
Authentication plugin 'caching_sha2_password' cannot be loaded (0) | 2022.02.20 |
[python]SyntaxError: (unicode error) (0) | 2022.01.05 |