Install Multiple Python Versions for Specific Project
MRO (Method Resolution Order)
most of codes are referenced from https://tibetsandfox.tistory.com/26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -Uz vcs_info | |
precmd() { vcs_info } | |
zstyle ':vcs_info:git:*' formats '%b ' | |
setopt PROMPT_SUBST | |
PROMPT='%F{#f8f8f2}%*%f %F{#bd93f9}%2~%f% %F{#ff5555}${vcs_info_msg_0_}%f$ ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.model.sql import Query # Query()는 개발자가 정의한 QuerySet을 읽어서 실제 SQL을 생성해주는 구현체다 | |
class QuerySet: | |
query: Query = Query() # 이것을 나는 메인쿼리 라고 명명한다. | |
_result_cache: List[Dict[Any,Any]] = dict() # SQL의 수행결과를 여기 저장해놓고 재사용한다 (QuerySet Cache) | |
# QuerySet 재호출시 이 프로퍼티에 저장된 데이터가 없으면 SQL을 호출해서 데이터를 가져온다. | |
_prefetch_related_lookups: Tuple[str] = () # prefetch_related(여기선언된 값들) 을 이 프로퍼티에 저장함 | |
# 이것을 나는 추가쿼리(셋)이라고 명명한다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nogil/python | |
WORKDIR / | |
# If enable gil uncomment below: | |
# ENV PYTHONGIL=1 | |
COPY ./main.py /main.py | |
CMD ["python", "/main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# use this line. if you want interact with terminal | |
# | |
# docker-compose exec web python3 manage.py createsuperuser --username "admin" --email "[email protected]" | |
# populate data for testing | |
# | |
# NOTE below code affect indent | |
docker-compose exec web sh -c " |
UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker
now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="errors" style=" | |
background: #c00; | |
color: #fff; | |
display: none; | |
margin: -20px -20px 20px; | |
padding: 20px; | |
white-space: pre-wrap; | |
"></div> | |
<div id="root"></div> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="errors" style=" | |
background: #c00; | |
color: #fff; | |
display: none; | |
margin: -20px -20px 20px; | |
padding: 20px; | |
white-space: pre-wrap; | |
"></div> | |
<div id="root"></div> | |
<script> |
NewerOlder