본문 바로가기

장고 프레임워크24

장고 db mysql 로 설정하기 위한 과정 nachwon.github.io/database-mysql/ [DB] Django 앱에 MySQL 연동하기 Django 어플리케이션에 MySQL 데이터베이스를 연동시키는 방법을 알아보자. nachwon.github.io 장고 mysql 연결하는 법 nickjoit.tistory.com/144 mysql 사용자추가/DB생성/권한부여 서버 관리를 하다보면 mysql 사용자 계정을 추가해 줄때가 있다. MySQL 접속 및 데이터 베이스 추가 # mysql -u root -p 사용자 계정을 추가하기 전에 먼저 현재 생성된 사용자 계정을 확인한다. mysql > use nickjoit.tistory.com k-channel.tistory.com/211 PC에 mysql 설치하고 유저(user)생성하기 mysql .. 2020. 9. 21.
파이썬 __builtin__ module attr 함수들 getAttr() value 뿐만 아니라 method도 getattr() function으로 가져올 수 있고, handler = getattr(self, "get", .. ) 으로 get function의 address를 handler 변수에 저장하여 get 함수를 handler("aaaa", "bbbb") 처럼 호출할 수 있다. - https://technote.kr/249 setAttr() - https://technote.kr/248 hasAttr() - https://technote.kr/251 delAttr() - https://technote.kr/250 2020. 8. 23.
djagno 현재 활성화된 User Model 가져오는 법 from django.contrib.auth import get_user_model User =get_user_model() 2020. 8. 22.
Django models.py에서 현재 프로젝트에 활성화된 User를 가져오는 법 ForeignKey 등에 추가할 때 from django.conf import settings 후 settings.AUTH_USER_MODEL 으로 User model 정보를 가져오는 방법이 옳은 방법이다. 왜나하면 이렇게 해야 프로젝트에서 장고 기본 User model을 사용하지 않고 Custom User Model을 정의해서 사용할 때 settings.py에 설정해 놓은 AUTH_USER_MODEL 값의 Custom User Model 정보를 읽을 수 있다. 2020. 8. 22.