점프투장고 postgresql migrate가 안됩니다.

aws 환경에서는 안하고 로컬환경에서 해보고 싶어서 따라했는데요,
postgresql 설치, db생성, 유저 패스워드 설정, psycopg2-binary 설치 등 다해도

(study) sys@sysui-MacBookPro mysite_endpoint % python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/core/management/base.py", line 373, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/core/management/base.py", line 417, in execute
    output = self.handle(*args, **options)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/core/management/base.py", line 90, in wrapped
    res = handle_func(*args, **kwargs)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 92, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/migrations/loader.py", line 53, in __init__
    self.build_graph()
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/migrations/loader.py", line 223, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations
    if self.has_table():
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/migrations/recorder.py", line 55, in has_table
    with self.connection.cursor() as cursor:
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/utils/asyncio.py", line 25, in inner
    return func(*args, **kwargs)
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/backends/base/base.py", line 270, in cursor
    return self._cursor()
  File "/Users/sys/opt/anaconda3/envs/study/lib/python3.8/site-packages/django/db/backends/dummy/base.py", line 20, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

이런 에러가 나오면서 안됩니다.
혹시나 해서 settings.py 를 분리하지 않은 다른 프로젝트로 마이그레이션 해보니 그건 잘 되더라구요
base.py와 local.py, prod.py에 다

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'pybo',
        'USER': 'dbmasteruser',
        'PASSWORD': '=eKmx$xxymnxxwNCxxx$SX55*RdjKK1G&',
        'HOST': 'ls-be78fd2cxxxxx614420dxxxxx6b156e2c9.cqlcyugj7ibs.ap-northeast-2.rds.amazonaws.com',
        'PORT': '5432',
    }
}

이 부분을 적었는데도 저런 에러가 떠서 이렇게 질문을 드립니다.
물론 네임,유저,패스워드는 다 제 설정대로 했고 호스트는 localhost로 적었습니다


base.py

"""
Django settings for config project.

Generated by 'django-admin startproject' using Django 4.0.1.

For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""

from pathlib import Path
import os, json
from django.core.exceptions import ImproperlyConfigured

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
#
# SECURITY WARNING: keep the secret key used in production secret!
secret_file = os.path.join(BASE_DIR, 'secrets.json')

with open(secret_file) as f:
    secrets = json.loads(f.read())


def get_secret(setting, secrets=secrets):
    try:
        print("check ", secrets[setting])
        return secrets[setting]
    except KeyError:
        error_msg = "Set the {} environment variable".format(setting)
        raise ImproperlyConfigured(error_msg)


SECRET_KEY = get_secret("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [
    '10.0.2.2',
    'localhost'
]

# Application definition

INSTALLED_APPS = [
    'common.apps.CommonConfig',
    'pybo.apps.PyboConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rest_framework',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'config.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'config.wsgi.application'

# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'mysite',
        'USER': 'postgres',
        'PASSWORD': 'postgres',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/

LANGUAGE_CODE = 'ko-kr'

TIME_ZONE = 'Asia/Seoul'

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = 'static/'
STATICFILES_DIRS = [
    BASE_DIR / 'static',
]

# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# 로그인 성공 후 이동하는 URL
LOGIN_REDIRECT_URL = '/'
# 로그아웃시 이동하는 URL
LOGOUT_REDIRECT_URL = '/'

# 로깅설정
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        },
        'require_debug_true': {
            '()': 'django.utils.log.RequireDebugTrue',
        },
    },
    'formatters': {
        'django.server': {
            '()': 'django.utils.log.ServerFormatter',
            'format': '[{server_time}] {message}',
            'style': '{',
        },
        'standard': {
            'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
        },
    },
    'handlers': {
        'console': {
            'level': 'INFO',
            'filters': ['require_debug_true'],
            'class': 'logging.StreamHandler',
        },
        'django.server': {
            'level': 'INFO',
            'class': 'logging.StreamHandler',
            'formatter': 'django.server',
        },
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'file': {
            'level': 'INFO',
            'filters': ['require_debug_false'],
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': BASE_DIR / 'logs/mysite.log',
            'maxBytes': 1024 * 1024 * 5,  # 5 MB
            'backupCount': 5,
            'formatter': 'standard',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console', 'mail_admins', 'file'],
            'level': 'INFO',
        },
        'django.server': {
            'handlers': ['django.server'],
            'level': 'INFO',
            'propagate': False,
        },
        'pybo': {
            'handlers': ['console', 'file'],
            'level': 'INFO',
        },
    }
}

local.py

from .base import *

ALLOWED_HOSTS = [
    '10.0.2.2',
    'localhost'
]
# base.py 파일의 모든 내용을 사용하지만 ALLOWED_HOSTS만 다르게 설정

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mysite',
        'USER': 'postgres',
        'PASSWORD': 'postgres',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

prod.py

from .base import *

ALLOWED_HOSTS = ['3.39.5.116']
STATIC_ROOT = BASE_DIR / 'static/'
STATICFILES_DIRS = []
DEBUG = False
# 보통 운영 환경을 production 환경이라고 한다.

코코코 768

M 2022년 2월 8일 12:46 오후

@박응용님 맥이라서 homebrew로 설치 후 따로 환경변수를 셋팅하지는 않았습니다. 환경변수를 설정하지 않아도 터미널에서 psql 명령어가 잘 작동하고 검색을 했을 때 맥은 설정을 안해주는거같더라구요 제가 잘못알고있는걸까요?? - 코코코님, 2022년 2월 8일 12:10 오후 추천 , 대댓글
@코코코님 로컬환경과 운영환경을 구분하는 환경변수 설정값을 어떻게 하셨는지 보고 싶어서요. - 박응용님, 2022년 2월 8일 12:37 오후 추천 , 대댓글
@박응용님 settings.py를 말씀하시는거라면 게시글 수정하여 업로드했습니다! - 코코코님, 2022년 2월 8일 12:48 오후 추천 , 대댓글
@코코코님 --settings=config.settings.local 또는 DJANGO_SETTINGS_MODULE 환경변수를 설정하셔야 하는데요.. 다음을 참고해서 정상적으로 설정하셨는지 확인해 보세요. https://wikidocs.net/75560#settings_1 - 박응용님, 2022년 2월 8일 1:17 오후 추천 , 대댓글
@박응용님 헐.. 명령어 쳐도 안먹고 그냥 뒤에 --settings=config.settings.local 붙여서 런서버하면 되길래 따로 설정을 안했는데, 맥에서는 set이아니라 export 명령어였고 방금 설정해보니 되네요.. 그럼 환경변수를 설정하지 않은상태에서는 python manage.py migrate --settings=config.settings.local 이라고 입력해줘야되는거네요.. 항상 감사합니다.. 이렇게 또 새로운걸 배우게 됐네요 - 코코코님, 2022년 2월 8일 1:37 오후 추천 , 대댓글
목록으로