Django 1.4中的静态文件夹结构?

Sah*_*bov 7 python convention django directory-structure django-1.4

这是新的项目结构(来自Django 1.4发行说明).

myproject
|-- manage.py
|-- myproject
|   |-- __init__.py
|   |-- settings.py
|   |-- urls.py
|   `-- wsgi.py
`-- polls
    |-- __init__.py
    |-- models.py
    |-- tests.py
    `-- views.py

我不确定的是我是否应该将STATIC_ROOT指向

myproject/myproject/static/ (连同settings.py,urls.py ......)

要么

顶级目录myproject/static(myproject,myapp1,myapp2旁边)?

okm*_*okm 7

STATIC_ROOT与Python导入无关,因此完全取决于您.通常,myproject/static/因此os.path.join(PROJECT_ROOT, 'static/')在设置中更容易.

更新为San4ez建议,并在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/"  
Run Code Online (Sandbox Code Playgroud)

根据您的结构,最好将poll应用程序的静态文件放入其中poll/static/.