[리눅스] python 배포 설정

 

# os.path.dirname: 상위 디렉토리
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

 

python3 zipapp -p "/usr/bin/cafe24/python3.7/bin/python3" python_crawler
python_crawler.pyz
python3 python_crawler.pyz

 

git 명령어 사용


.gitignore 생성

# .gitignore
.idea/
venv/

 

git rm -r --cached .
git add .
git commit -m '[메시지]'
git push

 

  1. python 설치 시, python aplication 실행(venv 아닌상황)

    1.1export PYTHONPATH='application 의존성 경로'

 

ex>
# git clone https://....
# pip3 install -r python_crawler/requirements.txt --target=python_crawler/packages
# export PYTHONPATH='/root/python-projects/python_crawler'
# python3 python_crawler

1.2 꼭 export PYTHONPATH 를 해야돼?

ex)

ex>
# git clone https://....
# pip3 install -r python_crawler/requirements.txt --target=python_crawler
# python3 python_crawler

1.3 압축

ex>
# git clone https://....
# pip3 install -r python_crawler/requirements.txt --target=python_crawler
# python3 -m zipapp python_crawler
# python3 python_crawler.pyz

 

1.4 실행 가능한 파일로 packaging 하기

ex>
# git clone https://....
# pip3 install -r python_crawler/requirements.txt --target=python_crawler
# python3 -m zipapp -p "/cafe24/python3.7/bin/python3" python_crawler
# ./python_crawler.pyz

 

HTTP -> [8080:tomcat-cafe24] <-- AJP --> [:apache:80] <- HTTP

HTTP -> [9090:tomcat-jenkins(server.xml):9009]

+ Recent posts