Django debug=False设置

1、建立相应目录:

  mkdir /usr/lib/python2.7/site-packages/django/mysite/static

2、在settings里指定目录:

  STATIC_ROOT="/usr/lib/python2.7/site-packages/django/mysite/static"

3、把相应所需样式脚本图片等拷贝或者链接到这个目录:

  cp -r uploads/urplus/ static/

  cp -r statics/bootstrap static/

  cp -r /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin static

4、编辑总url文件:

  vim mysite/urls.py       

    from django.conf import settings

    if settings.DEBUG is False:
        urlpatterns += patterns('',url(r'^static/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.STATIC_ROOT,}),)

posted @ 2016-12-05 16:29  songge1209  阅读(2041)  评论(0编辑  收藏  举报