Django Custom Management Command2 Django custom management command 크롤링하는 함수를 작성 후 이것들을 병렬 처리하기 위해 커스텀한 명령어를 생성함 import threading from django.core.management.base import BaseCommand from crawlers.get_cpu_list import get_cpu_list from crawlers.get_board_list import get_board_list class Command(BaseCommand): help = 'pcgg 크롤링 명령어' output_transaction = True def handle(self, *args, **options): tasks = [] task1 = threading.Thread(target=get_cpu_list) task2 = threading.. 2023. 9. 15. Requested setting LOGGING_CONFIG, but settings are not configured. 문제 상황 crawlers 앱 생성 후 내부에 crawler.py 파일 생성 파이썬으로 바로 실행시키려 하니 실행안되는 오류 발생 해결 방법 우선 아래의 코드를 파이썬 파일 최상단에 써줘야함 # 프로젝트 디렉토리의 경로를 파이썬에게 알려주는 방법 import sys sys.path.append('C:/Users/SSAFY/Desktop/pcgg_data') # 장고프로젝트를 실행하고 설정을 로드 import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PCGG_data.settings") import django django.setup() from crawlers.models import Cpu 현재 파이썬 파일은 장고 기본 파일이 아닌 내가 임의로 생성한.. 2023. 9. 13. 이전 1 다음