0
我使用whitenoise與服務員來服務我的靜態文件,但我無法讓它使用版本化的靜態文件。舉例來說,如果我有一個foo.js,我跑collectstatic後,白噪聲在我的靜態文件夾中創建下列文件:Django whitenoise版本控制不起作用
foo.js
foo.js.gz
foo.10a400e06df8.js
foo.10a400e06df8.js.gz where 10a400e06df8 is the unique version code that whitenoise generated for me.
這裏是我的wsgi.py文件:
from django.core.wsgi import get_wsgi_application
# This is the default application
application = get_wsgi_application()
def white():
# This is an alternative WSGI app that wraps static content
from whitenoise.django import DjangoWhiteNoise
white = get_wsgi_application()
white = DjangoWhiteNoise(white)
return white
這裏我怎樣包括在模板中的foo.js:
{% load static from staticfiles %}
...
<script src="{% static "foo.js" %}" type="text/javascript"></script>
我跑我的女服務員服務器,如下所示:
女服務員發球--port = 8080 --call myapp.wsgi:白色
當我打開我的網頁,我期待我會看到這在我的瀏覽器
<script src="/static/foo.10a400e06df8.js" type="text/javascript"></script>
但我仍然看到
<script src="/static/foo.js" type="text/javascript"></script>
我錯過了什麼嗎?在我的設置中,我確實有 STATICFILES_STORAGE ='whitenoise.django.GzipManifestStaticFilesStorage'
任何幫助或建議都非常感謝!