0

I was using Django and the static files cannot load, the error is:

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

Here is the 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})

It's weird that when I was using

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

to replace the last sentence in the views.py, the static files loads OK, but other problems would occur. Could anyone help me? Thank you very much.

Robert
  • 2,189
  • 6
  • 31
  • 38

2 Answers2

1

Are you using DefaultStorageFinder? If not just get rid of that in STATICFILES_FINDERS in settings.py.

dan-klasson
  • 13,734
  • 14
  • 63
  • 101
1

You need put the MEDIA_ROOT in your settings.py.

Schemetrical
  • 5,506
  • 2
  • 26
  • 43
youxun
  • 21
  • 1
  • 5