TIL - 0813-0817

이번주 해야 할 일

  • 이력서 작성하기
  • 자료구조 공부 1일 1개
  • 알고리즘 문제 3개 풀기

0813

오늘 해야 할 일

  • docker 배포 환경 스크립트 만들기
  • django 로그 production 환경에 추가
  • 자료구조 공부 및 정리-> 정리는 내일

오늘 한 일

  • celery 각 환경에서 실행되게끔 설정 -> setdefult 환경부분을 삭제 이게 없으면 export 된 환경에서 알아서 실행이 된다.

Deploy 스크립트 관련

  • container_commands : 무조건 배포 이전에 작동 leader_only 옵션 존재 -> leader 에만 특정 파일을 생성
  • files 에 넣은 스크립트 : 배포 이후에 작동하도록 할 수 있음, -> 특정 파일이 있을 경우에만
  • runserver export settings modules settings 참고 자료
  • subprocess로 runserver 를 실행하고 종료하는 경우 아래와 같은 오류가 뜨고 환경이 제대로 export 가 되지 않았다. 그래서 os.system으로 바꿈
# runserver_mode = f'export DJANGO_SETTINGS_MODULE=config.settings.{mode}'
# subprocess.call([runserver_mode], shell=True)
# subprocess.call('python app/manage.py runserver', shell=True)

Traceback (most recent call last):
  File "runserver_mode.py", line 67, in <module>
    mode_runserver(mode)
  File "runserver_mode.py", line 59, in mode_runserver
    subprocess.call('python app/manage.py runserver', shell=True)
  File "/home/kahee/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 269, in call
    return p.wait(timeout=timeout)
  File "/home/kahee/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 1457, in wait
    (pid, sts) = self._try_wait(0)
  File "/home/kahee/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 1404, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

runserver 오류


/* 정상적인 부분 */
System check identified no issues (0 silenced).
August 13, 2018 - 13:13:03
Django version 2.0.6, using settings 'config.settings.dev'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

/* 오류 */
System check identified no issues (0 silenced).
  • dev, production의 경우, RDS를 사용하기 때문에 보안그룹에 카페 IP 주소 다시 추가한 후 제대로 작동함

0814

오늘 할 일

  • 탐색트리 자료구조 정리하기

0815

오늘 할 일

  • 이력서 작성하기

0816

오늘 할 일

  • subprocess 부분 정리하기
  • 이진 탐색트리 정리
Sentry responded with an API error: APIError(Event dropped due to filter: web-crawlers)
["AttributeError: 'NoneType' object has no attribute 'find_all'", '  File "django/core/handlers/exception.py", line 35, in inner', '  File "django/core/handlers/base.py", line 128, in _get_response', '  File "django/core/handlers/base.py", line 126, in _get_response', '  File "django/views/decorators/csrf.py", line 54, in wrapped_view', '  File "books/views/api.py", line 53, in message', '  File "books/utils/crawling.py", line 215, in search_book', '  File "books/utils/crawling.py", line 186, in search_book_title', '  File "books/utils/crawling.py", line 151, in get_book_lists', '  File "books/utils/crawling.py", line 72, in get_book_location']


[pid: 25|app: 0|req: 44642/44642] 172.17.0.1 () {34 vars in 430 bytes} [Thu Aug 16 22:14:54 2018] GET / => generated 9949 bytes in 17 msecs (HTTP/1.1 200) 3 headers in 110 bytes (1 switches on core 0)
MahvnbUxiAhV
[pid: 25|app: 0|req: 44643/44643] 172.17.0.1 () {44 vars in 681 bytes} [Thu Aug 16 22:14:57 2018] POST /api/message => generated 225 bytes in 116 msecs (HTTP/1.1 200) 3 headers in 101 bytes (1 switches on core 0)
MahvnbUxiAhV

Sentry responded with an API error: APIError(Event dropped due to filter: web-crawlers)
["AttributeError: 'NoneType' object has no attribute 'find_all'", '  File "django/core/handlers/exception.py", line 35, in inner', '  File "django/core/handlers/base.py", line 128, in _get_response', '  File "django/core/handlers/base.py", line 126, in _get_response', '  File "django/views/decorators/csrf.py", line 54, in wrapped_view', '  File "books/views/api.py", line 53, in message', '  File "books/utils/crawling.py", line 215, in search_book', '  File "books/utils/crawling.py", line 186, in search_book_title', '  File "books/utils/crawling.py", line 151, ibn get_book_lists', '  File "books/utils/crawling.py", line 72, in get_book_location']
["AttributeError: 'NoneType' object has no attribute 'find_all'", '  File "django/core/handlers/exception.py", line 35, in inner', '  File "django/core/handlers/base.py", line 128, in _get_response',
 '  File "django/core/handlers/base.py", line 126, in _get_response',
  '  File "django/views/decorators/csrf.py", line 54, in wrapped_view',
  '  File "books/views/api.py", line 53, in message',
  '  File "books/utils/crawling.py", line 215, in search_book',
   '  File "books/utils/crawling.py", line 186, in search_book_title',
   '  File "books/utils/crawling.py", line 151, in get_book_lists',
   '  File "books/utils/crawling.py", line 72, in get_book_location']

172.17.0.1 - - [16/Aug/2018:13:13:52 +0000] "POST /api/message HTTP/1.1" 200 829 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:13:54 +0000] "GET / HTTP/1.1" 200 2718 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:13:58 +0000] "POST /api/friend HTTP/1.1" 200 2 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:05 +0000] "GET / HTTP/1.1" 200 2713 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:09 +0000] "GET / HTTP/1.1" 200 2716 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:13 +0000] "POST /api/message HTTP/1.1" 200 2723 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:18 +0000] "POST /api/message HTTP/1.1" 200 829 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:20 +0000] "GET / HTTP/1.1" 200 2710 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:24 +0000] "GET / HTTP/1.1" 200 2704 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:35 +0000] "GET / HTTP/1.1" 200 2712 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:38 +0000] "POST /api/message HTTP/1.1" 200 3573 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:39 +0000] "GET / HTTP/1.1" 200 2715 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:43 +0000] "POST /api/message HTTP/1.1" 200 1585 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:46 +0000] "POST /api/message HTTP/1.1" 500 27 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:50 +0000] "GET / HTTP/1.1" 200 2713 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:52 +0000] "POST /api/message HTTP/1.1" 500 27 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:14:54 +0000] "GET / HTTP/1.1" 200 2711 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:14:57 +0000] "POST /api/message HTTP/1.1" 200 225 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:15:01 +0000] "POST /api/message HTTP/1.1" 500 27 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:15:05 +0000] "POST /api/message HTTP/1.1" 200 225 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:15:05 +0000] "GET / HTTP/1.1" 200 2718 "-" "ELB-HealthChecker/2.0"
172.17.0.1 - - [16/Aug/2018:13:15:10 +0000] "POST /api/message HTTP/1.1" 200 3198 "-" "KakaoTalk/Bot 2.0"
172.17.0.1 - - [16/Aug/2018:13:15:10 +0000] "GET / HTTP/1.1" 200 2713 "-" "ELB-HealthChecker/2.0"


MahvnbUxiAhV	-	유럽문회
	MahvnbUxiAhV	-	ㅠㅠ 유럽...
	MahvnbUxiAhV	스위프트	-

0817

  • 졸업식
  • 새벽에 발생된 오류가 정확히 무엇인지는 알게 되었으나, 어떤 키워드에서 발생되는지 알 수 없어서 서버단에서 키워드 입력시 출력하는 문구를 추가했다.