settings: Unset STATIC_ROOT in development.

Django’s default FileSystemFinder disallows STATICFILES_DIRS from
containing STATIC_ROOT (by raising an ImproperlyConfigured exception),
because STATIC_ROOT is supposed to be the result of collecting all the
static files in the project, not one of the potentially many sources
of static files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-07-16 17:29:08 -07:00
committed by Tim Abbott
parent a97a2612bb
commit fd7803e7f4
13 changed files with 40 additions and 33 deletions

View File

@@ -7,6 +7,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls.resolvers import LocaleRegexProvider
from django.utils.module_loading import import_string
from django.utils.translation import ugettext as _
from zerver.lib.storage import static_path
"""This module declares all of the (documented) integrations available
@@ -86,9 +87,9 @@ class Integration:
def get_logo_url(self) -> Optional[str]:
logo_file_path_svg = self.DEFAULT_LOGO_STATIC_PATH_SVG.format(name=self.name)
logo_file_path_png = self.DEFAULT_LOGO_STATIC_PATH_PNG.format(name=self.name)
if os.path.isfile(os.path.join(settings.STATIC_ROOT, logo_file_path_svg)):
if os.path.isfile(static_path(logo_file_path_svg)):
return staticfiles_storage.url(logo_file_path_svg)
elif os.path.isfile(os.path.join(settings.STATIC_ROOT, logo_file_path_png)):
elif os.path.isfile(static_path(logo_file_path_png)):
return staticfiles_storage.url(logo_file_path_png)
return None