我想了解的靜態結構的Django 1.3試圖追求:Django的靜態結構
我有這個結構的項目:
Project
someapp
static
someapp
css
etcetera
models.py
views.py
urls.py
urls.py
manage.py
settings.py
現在我要覆蓋Django管理。所以我必須設置在settings.py,我不喜歡下面這些設置(基本路徑是把快捷方式路徑到當前目錄):
# 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 = BASE_PATH+'/static/'
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'
# 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.
)
如果我使用manage.py命令collectstatic,它科爾CTS所有靜態文件(包括管理文件)目錄中的預期「靜態」 ......(主項目目錄內)
然而,它的內容還沒有送達,直到我再補充一點目錄到STATICFILES_DIRS元組,然後,我不得不改變STATIC_ROOT目錄設置,否則我會得到他們不能相同的錯誤...
我想我忽略了明顯的,因爲我必須做的,使它工作似乎多餘
所以..你把你的文件實際存儲在進入'STATIC_DIRS'的目錄,並指出了'STATIC_ROOT'到__empty directory__ Django在何處可以收集靜態文件嗎? – agf