当我尝试它时404 error view
,我的样式不起作用。我试图创建自定义 404 视图,但它也不起作用。
这是我的代码。
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/'
我在模板中也有 404.html 页面。
这是浏览器错误。
加载资源失败:服务器响应状态为 404(未找到)