我可能只是累了,没有注意到这里有什么明显的东西,但是升级到 Django 1.5 后,我的静态文件的路径被破坏了。
设置.py
from os.path import abspath, basename, dirname, join, normpath
SITE_ROOT = dirname(dirname(abspath(__file__)))
SITE_NAME = basename(SITE_ROOT)
PROJECT_ROOT = dirname(SITE_ROOT)
STATIC_ROOT = normpath(join(SITE_ROOT, 'static', 'site_media'))
STATIC_URL = "/site_media/static/"
STATICFILES_FINDERS = (
"staticfiles.finders.FileSystemFinder",
"staticfiles.finders.AppDirectoriesFinder",
"staticfiles.finders.LegacyAppDirectoriesFinder",
"compressor.finders.CompressorFinder",
)
索引.html
<link rel="stylesheet" href="{{ STATIC_URL }}css/site_base.css" />