본문 바로가기

Python

(3)
Django project 생성시 자주 쓰는 명령어 가상환경 설정하기 goto venvs // collection of virtual env for each product python3 -m venv [project_name] ex) python3 -m venv facial_recog put alias in .profiles home directory 안의 .profile 에 alias 를 미리 등록하여 두면 log in 후 alias 를 실행하면 virtual 환경으로 쉽게 갈 수 있다. ex) alias facialsite='cd ~/projects/facial_recog;. ~/venvs/facial_recog/bin/activate' // add this one at the end of .profile file enter 'facialsite' a..
postman 사용법 w/ Django 사용하는 목적 Frontend s/w 가 준비되지 않은 상태에서 backend 에서 설계된 REST API 가 정상동작하는지 확인하기 위하여 사용한다. django 에서는 CSRF token 을 수반하여 server 로 통신을 한다. 하지만 일반적으로 cookie 는 자주 바뀌기 때문에 바뀐 X-CSRFToken 값을 postman 에서 자동으로 얻어오는 것을 tests tab 에 아래와 같이 작성해야 한다. 아래는 Django 애서 "dj_rest_auth", "dj_rest_auth.registration" 을 이용하여 User Account 를 만드는 api 를 확인하는 것이다 var xsrfCookie = postman.getResponseCookie("csrftoken"); postman.set..
Python - 정규표현식 Regular expression operations in Python https://docs.python.org/3/library/re.html re — Regular expression operations Source code: Lib/re/ This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode strings ( str) as well as 8-... docs.python.org Test site for regular expresion https://regex101.com/ regex101: ..