title: Django==2.1 , setting DEBUG to False results in 500 server error
body: <p>I have the following <code>settings.py</code> file for my django project: </p>
  
  <pre><code>"""
  
  Django settings for framework project.
  
  Generated by 'django-admin startproject' using Django 2.1.5.
  
  For more information on this file, see
  https://docs.djangoproject.com/en/2.1/topics/settings/
  
  For the full list of settings and their values, see
  https://docs.djangoproject.com/en/2.1/ref/settings/
  """
  import os
  from datetime import timedelta
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = '**************'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = False
  
  ALLOWED_HOSTS = ["*"]
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'graphene_django',
      'graphql_jwt.refresh_token.apps.RefreshTokenConfig',
      'django_filters',
      'sass_processor',
      'hamlpy',
      'ckeditor',
      'easy_select2',
      'members',
      'activity',
      'blog',
      'pages',
      'status',
      'gsoc'
  ]
  
  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 = 'framework.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'static')],
          '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',
              ],
              'loaders': (
                  'hamlpy.template.loaders.HamlPyFilesystemLoader',
                  'hamlpy.template.loaders.HamlPyAppDirectoriesLoader',
              ),
          },
      },
  ]
  
  WSGI_APPLICATION = 'framework.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      }
  }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/2.1/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/2.1/topics/i18n/
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'Asia/Kolkata'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  AUTHENTICATION_BACKENDS = [
      'graphql_jwt.backends.JSONWebTokenBackend',
      'django.contrib.auth.backends.ModelBackend',
  ]
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/2.1/howto/static-files
  
  GRAPHENE = {
      'SCHEMA': 'framework.schema.schema',
      'MIDDLEWARE': [
          'graphql_jwt.middleware.JSONWebTokenMiddleware',
      ],
  }
  GRAPHQL_JWT = {
      'JWT_ALLOW_ARGUMENT': True,
      'JWT_VERIFY_EXPIRATION': True,
      'JWT_LONG_RUNNING_REFRESH_TOKEN': True,
      'JWT_EXPIRATION_DELTA': timedelta(minutes=5),
      'JWT_REFRESH_EXPIRATION_DELTA': timedelta(days=7),
  }
  
  
  STATIC_URL = '/static/'
  STATICFILES_DIRS = (
      os.path.join(BASE_DIR, 'static/'),
  )
  
  SASS_PROCESSOR_ENABLED = True
  SASS_PROCESSOR_AUTO_INCLUDE = True
  SASS_PROCESSOR_ROOT = 'static/'
  
  STATICFILES_FINDERS = [
      'django.contrib.staticfiles.finders.FileSystemFinder',
      'django.contrib.staticfiles.finders.AppDirectoriesFinder',
      'sass_processor.finders.CssFinder',
  ]
  
  try:
      import django_heroku
      django_heroku.settings(locals())
  except ImportError:
      found = False
  </code></pre>
  
  <p>I wanted to add custom 404 and 500 error pages, for which I set DEBUG = False and ALLOWED_HOSTS = ["*"].
  But when I run the local server and view the website, I get <code>500 server error</code> for every page.
  However, the site works perfectly when DEBUG = True.
  How do I correct this issue?
  Similar question has been asked before, but the answers are old for the version of django.</p>