
얼마전 그누보드5로 만들어진 사이트를 마이그레이션을 해보았습니다.
이 과정에서 버그가 상당히 많이 발생해서,, 아래 나열된 몇몇 버그는 직접 수정을 거쳤고
기존에 사용하던 이윰빌더 기능들은 가급적 코어 부분을 건드리지 않고 플러그인 형태로 이식하여 작업을 진행중입니다.
이 과정에서 알게된 점 몇가지를 소개드리겠습니다.
1. 첨부파일 오동작
- g5_board_file 테이블에서 일괄적으로 앞에 /data/file/{보드이름}/ 을 추가해주면 정상 동작하는걸로 확인되었습니다.
2. 외부 이미지 썸네일 오작동
- 썸네일 불러오는 코드를 다음과 같이 변경하니 정상 작동하였습니다.
=============board_lib.py============================
def get_list_thumbnail(request: Request, board: Board, write: WriteBaseModel, thumb_width: int, thumb_height: int, **kwargs):
"""게시글 목록의 섬네일 이미지를 생성한다.
Args:
request (Request): _description_
board (Board): _description_
write (WriteBaseModel): _description_
thumb_width (int, optional): _description_. Defaults to 0.
thumb_height (int, optional): _description_. Defaults to 0.
"""
config = request.state.config
images, files = BoardFileManager(board, write.wr_id).get_board_files_by_type(request)
source_file = None
result = {"src": "", "alt": ""}
if images:
# TODO : 게시글의 파일정보를 캐시된 데이터에서 조회한다.
# 업로드 파일 목록
source_file = images[0].bf_file
result["alt"] = images[0].bf_content
else:
# TODO : 게시글의 본문정보를 캐시된 데이터에서 조회한다.
# 게시글 본문
editor_images = get_editor_image(write.wr_content, view=False)
for image in editor_images:
imageS = image
ext = image.split(".")[-1].lower()
# TODO: 아래 코드가 정상처리되는지 확인 필요
# image의 경로 앞에 /가 있으면 /를 제거한다. 에디터 본문의 경로와 python의 경로가 다르기 때문에..
if image.startswith("{HTTPS 도메인}"):
image = image.replace("HTTPS 도메인}","")
if image.startswith("HTTP 도메인}"):
image = image.replace("HTTP 도메인}","")
if image.startswith("/"):
image = image[1:]
# image경로의 파일이 존재하고 이미지파일인지 확인
if (os.path.exists(image)
and os.path.isfile(image)
and os.path.getsize(image) > 0
and ext in config.cf_image_extension):
source_file = image
break
else:
source_file = imageS
# 섬네일 생성
if source_file:
src = thumbnail(source_file, width=thumb_width, height=thumb_height, **kwargs)
if src:
result["src"] = '/' + src
else:
result["src"] = source_file
return result
===============썸네일 불러오는 코드===============================
기존 :
{% if thumbnail.src %}
<img src="/{{ thumbnail.src }}" alt="{{ thumbnail.alt }}">
{% else %}
변경 이후:
{% if thumbnail.src %}
<img src="{{ thumbnail.src }}" alt="{{ thumbnail.alt }}">
{% else %}
=============================================================
3. sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query')
상시로 이 문제가 발생하는데, 이건 저도 어떻게 해결해야 할지 영 모르겠습니다 ;;
댓글 5개
게시글 목록
| 번호 | 제목 |
|---|---|
| 206 | |
| 202 | |
| 180 | |
| 179 | |
| 176 | |
| 173 | |
| 169 | |
| 168 | |
| 166 | |
| 161 | |
| 157 | |
| 151 | |
| 149 | |
| 146 | |
| 139 | |
| 138 | |
| 132 | |
| 129 | |
| 115 | |
| 114 | |
| 113 | |
| 112 | |
| 107 | |
| 104 | |
| 97 | |
| 90 | |
| 78 | |
| 75 | |
| 73 | |
| 70 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기