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