我的html
<!DOCTYPE html>
{% load static %}
<html>
<head>
<title>Fish store</title>
<link rel="stylesheet" type="text/css" href="{% static 'css/animate.css' %}">
</head>
<body>
<h2>Home page</h2>
</body>
</html>
我的settings.py
INSTALLED_APPS = [
'fish.apps.FishConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
在fish应用程序中,我有静态文件夹和CSS文件夹,然后是animate.css 鱼/static/css/animate.css
主网址
urlpatterns = [
path('admin/', admin.site.urls),
path('',views.index)
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
现在我尝试访问http://localhost:8000/static/css/animate.css
它显示:
Not Found
The requested resource was not found on this server.