March 2020
Intermediate to advanced
608 pages
17h 17m
English
To use the system-check framework, go through these steps:
# myproject/apps/viral_videos/checks.pyfrom textwrap import dedentfrom django.core.checks import Warning, register, Tags@register(Tags.compatibility)def settings_check(app_configs, **kwargs): from django.conf import settings errors = [] if not settings.ADMINS: errors.append( Warning( dedent(""" The system admins are not set in the project settings """), obj=settings, hint=dedent(""" In order to receive notifications when new videos are created, define system admins in your settings, like: ADMINS = ( ("Admin", "administrator@example.com"), ) """), id="viral_videos.W001", ) ) return errors