old_contents: import os
  
  DATABASES = {
      'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'},
  }
  
  INSTALLED_APPS = [
      'gallery.apps.GalleryConfig',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.messages',
      'django.contrib.sessions',
      'django.contrib.staticfiles',
  ]
  
  LOGGING = {
      'version': 1,
      'handlers': {
          'null': {
              'class': 'logging.NullHandler',
          },
      },
      'loggers': {
          'django.request': {
              'handlers': ['null'],
              'propagate': False,
          },
      },
  }
  
  
  MIDDLEWARE = [
      '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 = 'gallery.test_urls'
  
  SECRET_KEY = 'Not empty for tests.'
  
  STATIC_ROOT = '.'
  
  STATIC_URL = '/static/'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [
              os.path.join(os.path.dirname(__file__), 'test_templates'),
          ],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'django.contrib.auth.context_processors.auth',
                  'django.template.context_processors.debug',
                  'django.template.context_processors.i18n',
                  'django.template.context_processors.media',
                  'django.template.context_processors.request',
                  'django.template.context_processors.static',
                  'django.template.context_processors.tz',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  
new_contents: from pathlib import Path
  
  BASE_DIR = Path(__file__).resolve().parent.parent
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': ':memory:',
      }
  }
  
  INSTALLED_APPS = [
      'gallery.apps.GalleryConfig',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.messages',
      'django.contrib.sessions',
      'django.contrib.staticfiles',
  ]
  
  LOGGING = {
      'version': 1,
      'handlers': {
          'null': {
              'class': 'logging.NullHandler',
          },
      },
      'loggers': {
          'django.request': {
              'handlers': ['null'],
              'propagate': False,
          },
      },
  }
  
  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 = 'gallery.test_urls'
  
  SECRET_KEY = 'Not empty for tests.'
  
  STATIC_ROOT = BASE_DIR
  
  STATIC_URL = '/static/'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [BASE_DIR / 'gallery' / 'test_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',
              ],
          },
      },
  ]
  
subject: Align test settings with startproject template.