0

我正在使用 Django 并且无法加载静态文件,错误是:

ImproperlyConfigured: The storage backend of the staticfiles finder <class 'django.contrib.staticfiles.finders.DefaultStorageFinder'> doesn't have a valid location.

这是views.py:

def results(request):
    metaUrl = ""
    if not request.method == 'POST':
        print "Not Post!"
    else:
        metaUrl = request.POST['urls']
    cmodel = InfoController()
    (firstList, wordList, sizeList) = cmodel.controller(metaUrl)
    print "I am at result"
    return render( request, 'infoRetriever/results.html', { 'firstList': firstList, 'wordList': wordList, 'sizeList': sizeList})

奇怪的是,当我使用

return render_to_response('infoRetriever/results.html', { 'firstList': firstList, 'wordList': wordList, 'sizeList': sizeList}, context_instance=RequestContext(request))

替换views.py中的最后一句,静态文件加载正常,但会出现其他问题。有人可以帮我吗?非常感谢。

4

2 回答 2

1

你在用DefaultStorageFinder吗?如果不只是摆脱它STATICFILES_FINDERSin settings.py

于 2013-08-07T07:04:12.590 回答
1

您需要MEDIA_ROOTsettings.py.

于 2015-05-08T01:55:45.587 回答