Django loads 404 in some CSS and JS files in the custom 404 page.

part of the CSS and JS files in the django Custom 404 page load
clipboard.png

404



clipboard.png

:
clipboard.png

if you don"t set it to a 404 error page, or set the 404 page to a simpler page (code like the), CSS file below, you can load normally

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    {% load staticfiles %}
    <meta charset="utf-8" />
    <title></title>
    <link href="{% static "main.css" %}" rel="stylesheet" />
</head>
<body>
    <h1>()</h1>
    <h1>404</h1>
</body>
</html>

could you tell me how to solve this problem?

Mar.10,2022

settings.py is not configured properly, is it?

check to see if the tuple of "STATICFILES_DIRS" contains your static files folder

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
    )

static resources are not loaded by default when debug is closed. Static files can be loaded by using python manage.py runserver-- insecure when starting, and running in unsafe mode

.
Menu