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,}),)