Fix #38 calling django.contrib.staticfiles.templatetags.staticfiles.static before collectstatic raise a ValueError.

In debug bug, it actually works and do not raise an exception, but in
non-debug mode, it tries to search the staticfiles manifest for the file.
If there is no manifest because collectstatic has not been run before, this fails.
This commit is contained in:
Valentin Samir 2018-04-29 19:04:59 +02:00
parent ee69b04b53
commit 753e3b5625
1 changed files with 14 additions and 4 deletions

View File

@ -17,10 +17,20 @@ from django.utils.translation import ugettext_lazy as _
from importlib import import_module
#: URL to the logo showed in the up left corner on the default templates.
CAS_LOGO_URL = static("cas_server/logo.png")
#: URL to the favicon (shortcut icon) used by the default templates. Default is a key icon.
CAS_FAVICON_URL = static("cas_server/favicon.ico")
try:
#: URL to the logo showed in the up left corner on the default templates.
CAS_LOGO_URL = static("cas_server/logo.png")
#: URL to the favicon (shortcut icon) used by the default templates. Default is a key icon.
CAS_FAVICON_URL = static("cas_server/favicon.ico")
# is settings.DEBUG is False and collectstatics has not been run yet, the static function will
# raise a ValueError because the file is not found.
except ValueError:
#: URL to the logo showed in the up left corner on the default templates.
CAS_LOGO_URL = None
#: URL to the favicon (shortcut icon) used by the default templates. Default is a key icon.
CAS_FAVICON_URL = None
#: Show the powered by footer if set to ``True``
CAS_SHOW_POWERED = True
#: URLs to css and javascript external components.