0

我真的很难建立我的 Django 站点(本地)。我已经阅读了其他问题和答案,但我无法弄清楚。

[20/Oct/2013 03:56:33] "GET /rides/ HTTP/1.1" 200 230
[20/Oct/2013 03:56:33] "GET /static/rides/style.css HTTP/1.1" 404 1649

静态的.css

    li a {
    color: green;
}

索引.html

{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'rides/style.css' %}" />

设置.py

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/

STATIC_URL = '/static/'

我的 style.css 位于

/Users/Marcus/Sites/Django/groupride/static/rides/style.css

有谁知道我该如何解决这个问题?

谢谢

4

1 回答 1

1

您想使用开发服务器提供静态服务,因此您需要在 urls.py 中添加以下内容:

(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/your/static/'}),

不要在生产环境中使用它。

于 2013-10-20T05:08:42.333 回答