私はまだ django を使い始めたばかりで、CSS の動作に問題があります。
リンクからの指示に従いました: Django Static Link tutorial、静的ファイルの処理について。しかし、それはまだ機能していません。
設定
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/Users/a9austin/Development/sites/AlphaSocks/src/static_root/'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/Users/a9austin/Development/sites/AlphaSocks/src/staticfiles'
)
見る
#from django.http import HttpResponse
from django.shortcuts import render_to_response
def index(request):
return render_to_response('index.html')
index.html
<link rel="stylesheet" href="{{STATIC_URL}}css/style.css" type="text/css" media="screen" >
そしてディレクトリ編成
src->staticfiles->css->style.css
どうもありがとう、あなたの助けと時間をありがとう!