这些是我的文件,请告诉我我做错了什么或需要进行哪些更改
settings.py
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'assets')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
index.html
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static
'firstapp/style.css' %}"/>
<h1>Here are all Albums</h1>
{% if all_albums %}
<ul>
{% for album in all_albums %}
<li><a href="{% url 'firstapp:detail' album.id %}">{{ album.album_title }}</a> </li>
{% endfor %}
</ul>
{% else %}
<h1>No data found</h1>
{% endif %}
style.css
body{
background: white url{"images/background.png"};
}
mysite / firstapp / urls.py
app_name = 'firstapp'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<album_id>[0-9]+)/$',views.detail, name='detail'),
url(r'^(?P<album_id>[0-9]+)/favorite/$', views.favorite, name='favorite'),
]
mysite / mysite / urls.py
urlpatterns = [
url('admin/', admin.site.urls),
url(r'^firstapp/', include('firstapp.urls')),
]