Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| public:computer:python [2021/08/03 15:38] – alex | public:computer:python [2023/01/02 15:20] (current) – [References] alex | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ===== prepare ===== | ===== prepare ===== | ||
| + | ==== on WSL2 ==== | ||
| + | {{page>: | ||
| ==== get python ==== | ==== get python ==== | ||
| Line 15: | Line 17: | ||
| * < | * < | ||
| - | <sxh bash> | + | <cli> |
| $ python3 hello_world.py | $ python3 hello_world.py | ||
| - | </sxh> | + | </cli> |
| ===== variables and types ===== | ===== variables and types ===== | ||
| Line 443: | Line 445: | ||
| * pygame | * pygame | ||
| - | <sxh bash> | + | <cli> |
| $ python3 -m pip install --user pygame | $ python3 -m pip install --user pygame | ||
| - | </sxh> | + | </cli> |
| <sxh python> | <sxh python> | ||
| Line 498: | Line 500: | ||
| ===== data visualization ===== | ===== data visualization ===== | ||
| - | <sxh bash> | + | <cli> |
| $ python3 -m pip install --user matplotlib | $ python3 -m pip install --user matplotlib | ||
| - | </sxh> | + | </cli> |
| <sxh python> | <sxh python> | ||
| Line 532: | Line 534: | ||
| * ax.get_yaxis().set_visible(False) | * ax.get_yaxis().set_visible(False) | ||
| - | <sxh bash> | + | <cli> |
| $ python3 -m pip install --user plotly | $ python3 -m pip install --user plotly | ||
| - | </sxh> | + | </cli> |
| * https:// | * https:// | ||
| Line 581: | Line 583: | ||
| - | <sxh bash> | + | <cli> |
| $ python3 -m pip install --user requests | $ python3 -m pip install --user requests | ||
| - | </sxh> | + | </cli> |
| <sxh python> | <sxh python> | ||
| Line 612: | Line 614: | ||
| ==== virtual environment ==== | ==== virtual environment ==== | ||
| - | <sxh bash> | + | <cli> |
| $ python3 -m venv ll_env | $ python3 -m venv ll_env | ||
| $ source ll_env/ | $ source ll_env/ | ||
| (ll_env)$ deactivate | (ll_env)$ deactivate | ||
| - | </sxh> | + | </cli> |
| ==== install django ==== | ==== install django ==== | ||
| - | <sxh bash> | + | <cli> |
| (ll_env)$ pip install django | (ll_env)$ pip install django | ||
| (ll_env)$ django-admin startproject learning_log . # learning_log라는 이름으로 프로젝트 생성 마지막에 . 반드시 입력 -> learning_log 디렉토리 안에 settings.py, | (ll_env)$ django-admin startproject learning_log . # learning_log라는 이름으로 프로젝트 생성 마지막에 . 반드시 입력 -> learning_log 디렉토리 안에 settings.py, | ||
| Line 625: | Line 627: | ||
| (ll_env)$ python manage.py startapp learning_logs | (ll_env)$ python manage.py startapp learning_logs | ||
| (ll_env)$ python manage.py runserver | (ll_env)$ python manage.py runserver | ||
| - | </sxh> | + | </cli> |
| ==== 모델 정의 ==== | ==== 모델 정의 ==== | ||
| Line 657: | Line 659: | ||
| * model을 수정하면 makemigrations를 먼저 실행하고 -> migrate 실행 | * model을 수정하면 makemigrations를 먼저 실행하고 -> migrate 실행 | ||
| - | <sxh bash> | + | <cli> |
| (ll_env)$ python manage.py makemigrations learning_logs | (ll_env)$ python manage.py makemigrations learning_logs | ||
| (ll_env)$ python manage.py migrate | (ll_env)$ python manage.py migrate | ||
| - | </sxh> | + | </cli> |
| * superuser 생성 | * superuser 생성 | ||
| Line 864: | Line 866: | ||
| * zip() | * zip() | ||
| * __import__() | * __import__() | ||
| + | |||
| + | ===== References ===== | ||
| + | * [[https:// | ||
| + | * <sxh python> | ||
| + | import uuid | ||
| + | strLongUUID = uuid.uuid1() | ||
| + | print(strLongUUID) | ||
| + | print(strLongUUID.bytes) | ||
| + | print(strLongUUID.hex) | ||
| + | print(strLongUUID.int) | ||
| + | print(strLongUUID.fields) | ||
| + | print(strLongUUID.urn) | ||
| + | print('' | ||
| + | |||
| + | #pip install shortuuid | ||
| + | import shortuuid | ||
| + | strShortUUID = shortuuid.uuid() | ||
| + | print(strShortUUID) | ||
| + | print(len(strShortUUID)) | ||
| + | </ | ||