2

When I try it gives 404 error view, my styles doesn't work. I tried to create custom 404 view but it also doesn't work.

Here is my code.

settings.py

   DEBUG = False
   TEMPLATE_DEBUG = DEBUG

   ALLOWED_HOSTS = ['*']

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

STATIC_URL = '/static/'

I have 404.html page too in templates.

Here is the browser error.

Failed to load resource: the server responded with a status of 404 (Not Found)

yass
  • 849
  • 1
  • 7
  • 13
David Grigoryev
  • 125
  • 1
  • 11

1 Answers1

1

When there is DEBUG = False default Django package will not serve any static files from your server . You have to use a nginx like tool to serve your files and it is a condition like production server.

Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57