전체 글 88

Using Rotating-Logging in Python

Python 에서 Log 를 생성할 때 사용하는 기본 내장형 모듈 Linux 기반에서는 많이 사용 : tail -F xxxx.log 식으로 사용하며 모니터링 용으로도 사용함 아래 코드는 10Mb 단위의 로그 파일을 최대 5개까지만 생성하여 로그 유지 용량 기준으로만 생성되고 삭제되기 때문에 로그량에 따라 최대 갯수를 늘리거나 줄여야함 import logging from logging.handlers import RotatingFileHandler # CREATE LOG - GLOBAL PARAMETER logger = logging.getLogger('xxx') def setting_logging(): # file max size를 10MB로 설정 file_max_bytes = 10 * 1024 * 10..

Zip Extract on Memory (Python)

물리적 경로에 압축 해제 하지 않고 메모리에 Bytes로 해제 할 경우 사용 아래는 압축 해제 후 Json Load 까지 진행 def open_zip_file(file_path : str): logger.info('# Zip File Extract START.') json_data = None with zipfile.ZipFile(file_path, 'r') as json_zip_file: for file_name in json_zip_file.namelist(): if '.json' in file_name.lower(): zip_data = json_zip_file.read(file_name).decode('UTF-8') json_data = json.loads(zip_data) return json_..

FTP Sending From Memory (Python)

압축 상태의 파일을 물리적 경로에 해제하지 않고 메모리에 해제 후 FTP 전송 def Sending_FTP_Server(news_id, xml_string : str, json_zip_file_path): logger.info('# FTP SENDING START.') session = ftplib.FTP() session.connect('10.101.33.xxx', 21) session.login('xxxxx', 'xxxxx') session.encoding = 'UTF-8' with zipfile.ZipFile(json_zip_file_path, 'r') as json_zip_file: for file_name in json_zip_file.namelist(): bytes_io = io.BytesIO..

Rocky Linux 9에 Docker 및 Docker-Compose를 설치하는 방법

Let’s dive on Docker Installation steps, Step 1) Install updates and reboot Login to Rocky Linux and install all the available updates and then reboot the system once. $ sudo dnf update -y $ reboot Step 2) Configure Docker Package Repository & Install Docker To install latest and stable version of docker, configure its official package repository using the following command, $ sudo dnf config-ma..

Install Docker and Docker-compose on CentOS7

Docker 설치 docker를 사용하면 운영체제와 독립적인 이미지를 인스턴스로 올려 컨테이너로 작동시킬 수 있다. 아키텍쳐의 구성 및 확정, 배포 방법이 비약적으로 간소화된다. CentOS 7에서의 설치 및 실행 방법은 아래와 같다. # Docker 저장소 설치 $ curl -fsSL https://get.docker.com/ | sh # Docker 서비스 시작 $ sudo systemctl start docker # Docker 서비스 작동 상태 확인 $ sudo systemctl status docker # Docker 서비스를 운영체제 부팅시 자동 시작하도록 설정 $ sudo systemctl enable docker # docker 명령어를 sudo 없이 사용하기 위해 계정을 docker 그룹..

위례 201 사진관 - 아기 50일 촬영

* 201 사진관 (위례) : http://www.we201.com/main.html 이번에 50일 촬영을 위해 이용한 사진관 후기를 공유드립니다 (feat, 내돈내산). 우선 조리원 & 산부인과와 연계된 스튜디오는 마음에 드는 곳이 없었기에, 근처 괜찮은(위치, 가격, 사진) 스튜디오를 찾아보다가 발견한 곳이 201 사진관입니다. 우선 다른 스튜디오와는 다르게 고객이 찍을 수 있는 컨셉 횟수를 지정할 수 있는 점이 이 스튜디오의 가장 큰 매력이었습니다. 1컨셉 촬영에 평일 / 주말이 약간의 가격 차이는 있지만 그래도 매력적인 가격이었고, 리뷰를 꼼꼼하게 확인했지만 결과물 또한 만족스러웠습니다. 그래서 50일 촬영은 이곳으로 결정하고 진행하게 되었습니다. 첫 입구에 저희 가족을 환영해 주시는 웰컴 문구가..

마음의 여유 2021.12.06

Python 실행 파일 만들기

https://wikidocs.net/21952 # one-file, clean cache $ pyinstaller -F --clean listener_by_python.py 제작한 Python 파일(.py)을 실행파일(.exe)로. PyInstaller를 이용하면 파이썬과 PyQt5로 제작한 GUI 프로그램을 간단하게 실행파일 (exe)로 만들 수 있습니다. (PyInstaller 홈페이지) 실행파일은 파이썬이 설치되어 있지 않은 pc에서도 프로그램을 실행할 수 있도록 해줍니다. PyInstaller 설치 실행파일 만들기 콘솔창 출력되지 않도록 하기 실행파일 하나만 생성하기 PyInstaller 설치 우선 명령프롬프트에서 아래의 명령어를 통해 PyInstaller 패키지를 설치합니다. -> python..