뷰 폴더 복사하기 강의를 듣고 있습니다. configureWebpack 를 추가하는 부분에서 에러가 발생합니다. configureWebpack: { plugins: [ new FileManagerPlugin({ events: { onStart: { delete: [ '../backend/static/**', '../backend/templates/**', ], }, onEnd: { copy: [ { source: './dist/static', destination: '../backend/static' }, { source: './dist/favicon.ico', destination: '../backend/static/img/' }, { source: './dist/home.html', destination: '../backend/templates/' }, { source: './dist/dashboard.html', destination: '../backend/templates/dashboard/' }, ], }, }, }), ], }, 위와 같이 따라서 코드를 입력했는데 다음의 에러가 발생합니다. ERROR Error loading vue.config.js: ERROR TypeError: defineConfig is not a function TypeError: defineConfig is not a function at Object.<anonymous> (E:\Enterprise\DonkeyJim\frontend\vue.config.js:5:18) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Service.loadUserOptions (E:\Enterprise\DonkeyJim\frontend\node_modules\@vue\cli-service\lib\Service.js:283:22) at Service.init (E:\Enterprise\DonkeyJim\frontend\node_modules\@vue\cli-service\lib\Service.js:72:30) at Service.run (E:\Enterprise\DonkeyJim\frontend\node_modules\@vue\cli-service\lib\Service.js:204:10) 어떤 부분이 문제인지 모르겠습니다.
현재 sec4에 webpack devserver 부분을 수강 중입니다. 강의에서는 devServer에 index 만 넣어도 잘 되는데 제가 했을 때는 잘 안 되었고, 다음과 같은 에러가 떴습니다. ERROR ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. - options has an unknown property 'index'. These properties are valid: object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? } chatGPT에 물어보니 다음과 같이 해야 한다고 답변을 받았습니다. devServer: { static: { directory: path.join(__dirname, 'dist'), watch: true, }, historyApiFallback: { rewrites: [ { from: /^\/home$/, to: '/home.html' }, { from: /^\/dashboard$/, to: '/dashboard.html' }, { from: /./, to: '/index.html' } // 모든 기타 요청을 index.html로 리디렉션 ] } }, 그런데 이렇게 해도 Cannot GET / 에러만 뜨고 화면이 나오지 않는데 어떤 부분이 문제인지 모르겠습니다. 현재 저는 강의를 들으면서 블로그를 만드는 것을 그대로 따라하지 않고 제가 만들고 싶은 것을 제작하는 중입니다.
강의를 보면서 따라하고 있는데, 2가지 문제점이 있습니다. 우선 첫번째는 아래처럼, 환경 변수 관련 경고가 뜬다는 것입니다. 두번째로는 강의에서는 파이참으로 진행하셨는데, 저는 vs 코드로 진행하여서 sqltools를 다운받아, 드라이브 설치후 진행하였는데 mysql은 잘 연동되었는 postgresql은 연동이 안되더라고요. 앞선 환경변수 문제와 관련이 있는것인지 아니라면 어떻게 해결해야하는것인지 궁금합니다. 오류 코드 docker-compose up -d WARN[0000] The "g" variable is not set. Defaulting to a blank string. WARN[0000] The "z" variable is not set. Defaulting to a blank string. WARN[0000] The "gl8f5tn_" variable is not set. Defaulting to a blank string. WARN[0000] The "g" variable is not set. Defaulting to a blank string. WARN[0000] The "z" variable is not set. Defaulting to a blank string. WARN[0000] The "gl8f5tn_" variable is not set. Defaulting to a blank string. WARN[0000] The "g" variable is not set. Defaulting to a blank string. WARN[0000] The "z" variable is not set. Defaulting to a blank string. WARN[0000] The "gl8f5tn_" variable is not set. Defaulting to a blank string. 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
안녕하세요. 강의와는 무관한 질문이지만 본 강의 수강 완료 후 혼자서 프로젝트를 하고 있습니다. 현재 구글 리뷰 크롤링 & 스크랩중인데요. 해당 에러가 발생하는 이유를 도무지 찾을 수 가 없어서 질문 드립니다... 여러 사이트를 크롤링 해보고 엑셀을 생성 해 보았지만 왜 이런 에러가 발생하는지 로그를 봐도 제대로 표시가 안되니깐 찾기가 힘드네요. 구글 리뷰 사이트만 20여개 스크랩 했었고 엑셀도 제대로 생성 되었으니 스크랩 코드 자체에는 문제가 없는거 같습니다. 다만 이 부분에서만 문제가 생깁니다. ### 에러 발생 로그 [2024-06-12 09:42:59,954] [ERROR utils.py:179] >> Traceback (most recent call last): File "scraper\scrap_crawlers.py", line 1365, in get_review_details File "scraper\utils.py", line 202, in create_xlsx_file File "scraper\utils.py", line 181, in create_xlsx_file File "pandas\util\_decorators.py", line 333, in wrapper File "pandas\core\generic.py", line 2417, in to_excel File "pandas\io\formats\excel.py", line 952, in write File "pandas\io\excel\_openpyxl.py", line 490, in write cells File "openpyxl\cell\cell.py", line 218, in value File "openpyxl\cell\cell.py", line 197, in bind value File "openpyxl\cell\cell.py", line 165, in check_string openpyxl.utils.exceptions.IllegalCharacterError: 동생한테추천받았는데이렇게편한어플이있다니너무좋아요.현금비율은좋지않지만 신경많이안써도되서괜찮네요~ cannot be used in worksheets. During handling of the above exception, another exception occurred: ### cannot be used in worksheets. 이놈이 말썽이네요... 아래와 같이 테스트 케이스 만들어서 적용했을 때는 제대로 작동했었습니다. import asyncio from scraper.utils import create_xlsx_file, save_to_xlsx DEFAULT_NAME = "test" async def main(): data = { "message": "동생한테추천받았는데이렇게편한어플이있다니너무좋아요.현금비율은좋지않지만 신경많이안써도되서괜찮네요~" } xlsx_file = await create_xlsx_file( data, file_name=DEFAULT_NAME, sheet_name=DEFAULT_NAME ) await save_to_xlsx(xlsx_file, DEFAULT_NAME) asyncio.run(main()) # utils.py # 엑셀 가로 폭 조정하는 함수 async def calculate_dimension(worksheet: Worksheet) -> None: try: for column_cells in worksheet.iter_cols(): length = max(len(str(cell.value)) for cell in column_cells) adjusted_width = (length + 2) * 1.2 # 조정된 폭 계산 column_letter = get_column_letter(column_cells[0].column) worksheet.column_dimensions[column_letter].width = adjusted_width except Exception as e: message = f"엑셀 폭 조정 중에 예외 발생: '\n{e}" logger = await get_logger() logger.error(message) print(message) raise e # 엑셀에 서식 스타일 지정하는 함수 async def cell_pattern_fill( df: pd.DataFrame, worksheet: Worksheet, head_fill_color: str = "4472C4", head_font_color: str = "FFFFFF", body_fill_color: str = "D9E1F2", body_font_color: str = "000000", head_border_color: str = "2E5C99", body_border_color: str = "B4C6E7", fill_type: fills = "solid", ) -> None: try: # Define border styles thin_border_head = Border( left=Side(border_style="thin", color=head_border_color), right=Side(border_style="thin", color=head_border_color), top=Side(border_style="thin", color=head_border_color), bottom=Side(border_style="thin", color=head_border_color), ) thin_border_body = Border( left=Side(border_style="thin", color=body_border_color), right=Side(border_style="thin", color=body_border_color), top=Side(border_style="thin", color=body_border_color), bottom=Side(border_style="thin", color=body_border_color), ) # Set header row style for row in worksheet.iter_rows( min_row=1, max_row=1, min_col=1, max_col=df.shape[1] ): for cell in row: cell.fill = PatternFill( start_color=head_fill_color, end_color=head_fill_color, fill_type=fill_type, ) cell.font = Font(color=head_font_color, bold=True) cell.border = thin_border_head # Set body row style for i, row in enumerate( worksheet.iter_rows( min_row=2, max_row=worksheet.max_row, min_col=1, max_col=df.shape[1] ) ): for cell in row: if i % 2 == 0: cell.fill = PatternFill( start_color=body_fill_color, end_color=body_fill_color, fill_type=fill_type, ) cell.font = Font(color=body_font_color) cell.border = thin_border_body except Exception as e: message = f"엑셀 서식 지정 중에 예외 발생: '\n{e}" logger = await get_logger() logger.error(message) print(message) raise e # 본 강의 drf 엑셀 생성 파트를 참고해서 만든 엑셀 생성 함수 async def create_xlsx_file( data: Union[Dict, List], file_name: str = DEFAULT_DIR_NAME, sheet_name: str = DEFAULT_DIR_NAME, ) -> BytesIO: df = pd.json_normalize(data) io = BytesIO() io.name = file_name try: writer = pd.ExcelWriter(io, engine="openpyxl") # noqa df.to_excel( writer, index=False, engine="openpyxl", sheet_name=sheet_name, ) workbook = writer.book worksheet = workbook.active tasks = [ calculate_dimension(worksheet), cell_pattern_fill(df, worksheet), ] await tqdm.gather(*tasks, desc=f" 엑셀 파일 생성중") writer._save() # noqa except Exception as e: message = f"엑셀 생성 중에 예외 발생: '\n{e}" logger = await get_logger() logger.error(message) print(message) raise e io.seek(0) return io # 엑셀 저장 함수 async def save_to_xlsx( xlsx_file: BytesIO, dirname: str = DEFAULT_DIR_NAME, ): output_path = BASE_DIR / "스크랩_결과" / "엑셀" / dirname output_path.mkdir(parents=True, exist_ok=True) now = datetime.datetime.now() timestamp = now.strftime("%Y-%m-%d_%H_%M") filename = f"{xlsx_file.name}_{timestamp}" extension = ".xlsx" file_path = output_path / (filename + extension) try: async with aiofiles.open(file_path, "wb") as f: await f.write(xlsx_file.getvalue()) except Exception as e: message = f"엑셀 파일 저장 중에 예외 발생: '{filename}'\n{e}" logger = await get_logger() logger.error(message) print(message) raise e 전체적인 함수는 위와 같으며 엑셀 생성 중에 에러가 발생하였으니 create_xlsx_file 함수 부분에서 해결을 해보아야 할것 같습니다. 아니면 혹시 엑셀의 행을 생성 중에 에러가 발생하였을 때 해당 행은 스킵하고 이어서 진행하게 하는 방법이 있을까요?? "raise e"을 발생 시키지 않아도 엑셀 생성 작업 스킵이 되지않고 작업 자체에 문제가 생기네요
mysql 에 테이블을 기존에 만들어 둔게 있습니다. 다른 서비스가 데이터를 쌓아 놓는 테이블인데 여기를 ORM으로 조회를 한번 해보고 싶습니다. 로그성 테이블이라 pk가 없습니다. python manage.py inspectdb 로 모델 코드를 만들어 내긴 했습니다. python shell로 조회를 하려고 하는데 id 필드를 찾으려는 시도를 계속 합니다. 기존에 만들어진 DB 스키마를 ORM으로 사용려고 만든 것이 inspectdb 일것 같은데 장고 ORM 구조가 PK를 필수로 가져야 하는 구조인지 궁금합니다. (구글링 해보면 PK가 필수라는 이야기도 있고, CHATGPT에게 물어보면 Meta클래스에 managed가 False이면 괜찮다는 답변이 나오네요) inspectdb로 만들어진 코드에는 Meta 클래스가 아래와 같이 있습니다. class MacLog(models.Model): timestamp = models.DateTimeField() sw_ip = models.CharField(max_length=20) mac = models.CharField(max_length=255) port = models.CharField(max_length=20) class Meta: managed = False db_table = 'mac_log' 다음은 에러가 나는 내용 입니다. >>> from django.db.models import QuerySet >>> from maccol.models import MacLog >>> >>> qs = QuerySet(MacLog) >>> for item in qs: ... print(item) ... None Execution time: 0.019902s [Database: default] Traceback (most recent call last): File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute return self.cursor.execute(query, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute res = self._query(mogrified_query) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query db.query(q) File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 261, in query _mysql.connection.query(self, query) MySQLdb.OperationalError: (1054, "Unknown column 'mac_log.id' in 'field list'") The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<console>", line 1, in <module> File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/models/query.py", line 398, in __iter__ self._fetch_all() File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1881, in _fetch_all self._result_cache = list(self._iterable_class(self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/models/query.py", line 91, in __iter__ results = compiler.execute_sql( ^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql cursor.execute(sql, params) File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django_extensions/management/debug_cursor.py", line 49, in execute return utils.CursorWrapper.execute(self, sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute return self.cursor.execute(query, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute res = self._query(mogrified_query) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query db.query(q) File "/Users/dcu/workspace/maccol/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 261, in query _mysql.connection.query(self, query) django.db.utils.OperationalError: (1054, "Unknown column 'mac_log.id' in 'field list'")
현재상황은 다음과 같습니다. 윈도우 gui 오토메이션을 해야하는 task 가 있습니다. 큐(sqs)는 우선큐 일반큐 두개를 스위칭 해야하는 상황입니다. 우선큐에 메세지가 없을경우만 일반큐를 컨슘해야합니다. 메세지를 처리하는 인스턴스는 윈도우 gui 를 사용하기 때문에 한대의 장비에서 동시에 하나의 task 만 실행될 수 있습니다. 위의 제약조건들로 인하여 gui 기반의 셀레니움 자동화 스크립트를 구성하고 우선큐와 일반큐를 스위칭하면서 10개 이상의 윈도우 장비가 큐를 폴링하고 있습니다. 이를 윈도우 장비 하나에 하나의 스탠드얼론 워커를 띄우는 형태로 구성하고. 예를 들어 열개의 인스턴스에 각각하나씩 열개의 스탠드얼론 셀러리 워커를 띄우려고 합니다. 하나의 스탠드 얼론 워커가 두개의 큐를 priority 따라서 폴링하는게 가능할까요? 스펙상에서는 되는거 같긴한데 문서를 봐도 잘 모르겠어서 혹시나 문의드립니다. 안된다면 각각의 큐를 폴링하는 스탠드 얼론 워커를 인스턴스에 브로커의 개수만큼 띄우고 (하나의 인스턴스 두개의 스탠드얼론워커) 뒤에 별도의 자동화 로직을 구성하고 큐의 우선순윈는 서비스로직으로 풀어야 하나 고민중입니다.
데이터베이스 sqlite연결하고 models.py 파일들어가서도 변경했습니다 변경하고 모델 Song 클래스 table까지 생성완료했습니다 그런데 사진과 같이 예상외 오류가뜹니다 그전까지는 핫트랙 홈페이지가 잘떳습니다 오류내용보니 전혀 건들이지 않는 views.py song.from_dic 에서 오류가 먼저 났습니다 이유를 잘 모르겠습니다...
board_text=richtextfield(null=true)를 넣으면 원하는 형태의 richtextfield가 출력이 되는데 board_text=richtextuploadingfield(null=true)로 바꾸면 단순히 listbox(textbox)가 나옵니다. 똑같이 코드를 하였는데 ,뭐가 잘못된 것인가요? 환경은 windows 10입니다.