From beb8f8bc4eba0aec6d11ccdfdce6142fe03d3932 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Tue, 15 Dec 2015 18:44:09 +0000 Subject: [PATCH] Add system check to confirm that compiled CSS files are present. Fixes #1720. Thanks to Shu Ishida for initial development on this feature. --- wagtail/wagtailadmin/apps.py | 2 ++ wagtail/wagtailadmin/checks.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 wagtail/wagtailadmin/checks.py diff --git a/wagtail/wagtailadmin/apps.py b/wagtail/wagtailadmin/apps.py index c963dadef..7130ba77f 100644 --- a/wagtail/wagtailadmin/apps.py +++ b/wagtail/wagtailadmin/apps.py @@ -1,5 +1,7 @@ from django.apps import AppConfig +from . import checks # NOQA + class WagtailAdminAppConfig(AppConfig): name = 'wagtail.wagtailadmin' diff --git a/wagtail/wagtailadmin/checks.py b/wagtail/wagtailadmin/checks.py new file mode 100644 index 000000000..81b47d564 --- /dev/null +++ b/wagtail/wagtailadmin/checks.py @@ -0,0 +1,30 @@ +import os + +from django.core.checks import Error, register + + +@register() +def css_install_check(app_configs, **kwargs): + errors = [] + + css_path = os.path.join( + os.path.dirname(__file__), 'static', 'wagtailadmin', 'css', 'normalize.css' + ) + + if not os.path.isfile(css_path): + error_hint = """ + Most likely you are running a development (non-packaged) copy of + Wagtail and have not built the static assets - + see http://docs.wagtail.io/en/latest/contributing/developing.html + + File not found: %s + """ % css_path + + errors.append( + Error( + "CSS for the Wagtail admin is missing", + hint=error_hint, + id='wagtailadmin.E001', + ) + ) + return errors