본문 바로가기
Django

[Django] 인증(Authentication)

by 기록하는_사람 2022. 12. 20.

인증(Authentication)

📌 인증(Authentication)

- 필요에 따라 설정할 수 있음.

- User는 기본적으로 username과 password를 가지고 있음.

  따라서, 부가적인 필드는 User의 필드로 정의하면 됨.

from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.
class User(AbstractUser):
    pass

 

📌 config/settings.py에 'AUTH_USER_MODEL = "(appname).User" 추가.

 

📌 config/settings.py에 설정 후, 마이그레이션을 해야 함. 

댓글