-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mozilla/django-system-check
Add Django system check for settings
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
# TODO check required settings | ||
from django.core.checks import Error, register | ||
from django.core.exceptions import ImproperlyConfigured | ||
|
||
from .settings import settings as smartling_settings | ||
|
||
|
||
@register() | ||
def smartling_settings_check(app_configs, **kwargs): | ||
errors = [] | ||
try: | ||
str(smartling_settings.PROJECT_ID) | ||
except ImproperlyConfigured as e: | ||
errors.append( | ||
Error( | ||
e.args[0], | ||
id="wagtail_localize_smartling.E001", | ||
) | ||
) | ||
return errors |