0

我真的需要你的帮助。我知道这个问题已经被问过很多次了,但现在我面临着 django 1.6.5 的奇怪行为。问题是在我的项目中,模板中的 STATIC_URL 停止工作。我的设置:

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)
  • BASE_DIR = os.path.dirname(os.path.dirname( file ))

其他设置设置为默认值。

模板中的 {{ STATIC_URL }} 返回空字符串。

我尝试在设置中使用 STATICFILES_FINDERS、TEMPLATE_CONTEXT_PROCESSORS - 没有任何改变。

尝试更改views.py:

def home(request):
    return render_to_response('index.html', {},
                              context_instance=RequestContext(request))



@render_to('index.html')
def home(request):
    return {}
4

0 回答 0