当前位置: 代码迷 >> Web前端 >> django1.3指定static静态资根目录
  详细解决方案

django1.3指定static静态资根目录

热度:386   发布时间:2012-08-29 08:40:14.0
django1.3指定static静态资源目录
1、修改settings.py如下
import os
# 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.
    os.path.join(os.path.dirname(__file__), 'static').replace('\\','/'),
)

2、根目录下创建static目录
3、启动后可直接访问/static/ 下的资源
  相关解决方案