1. postgres 설치
pip install psycopg2-binary
2. 데이터베이스 생성
set PGUSER=postgres
psql
psql -U postgres
CREATE USER usr_pet WITH PASSWORD '123';
CREATE DATABASE db_pet OWNER usr_pet;
3. base.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'db_pet',
'USER': 'usr_pet',
'PASSWORD': '123',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
4. models.py
userauth/models.py
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
pass
5. base.py
# custom user model
AUTH_USER_MODEL = 'userauth.CustomUser'
'Back-End > PythonEatsTail' 카테고리의 다른 글
06 Signup and password reset with allauth in Django (0) | 2021.12.09 |
---|---|
05 Git and local settings in Django (0) | 2021.12.08 |
04 Setting up validated login with allauth in Django (0) | 2021.12.08 |
03 Setting up allauth in Django (0) | 2021.12.08 |
02 Adding extra fields to a Django custom user model (0) | 2021.12.07 |