Last active
June 14, 2022 05:07
-
-
Save bryanchow/d30c0c7021f93b416744 to your computer and use it in GitHub Desktop.
Revisions
-
bryanchow revised this gist
Jun 14, 2022 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,9 +14,11 @@ def require_settings(*args): require_settings(['SITE_URL', 'DEFAULT_DOMAIN']) """ if len(args) == 1 and not isinstance(args[0], str): args = args[0] for key in args: if not hasattr(settings, key): raise ImproperlyConfigured( "{} not defined in settings".format(key) ) -
bryanchow revised this gist
Feb 15, 2016 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # https://gist.github.com/bryanchow/d30c0c7021f93b416744 from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -17,4 +19,4 @@ def require_settings(*args): for key in args: if not hasattr(settings, key): raise ImproperlyConfigured, "%s not defined in settings" % key -
bryanchow renamed this gist
Feb 15, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
bryanchow created this gist
Feb 15, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured def require_settings(*args): """ Check django.settings for the presence of the specified keys. Accepts settings keys as function args, or as a list of strings. Usage: require_settings('SITE_URL', 'DEFAULT_DOMAIN') require_settings(['SITE_URL', 'DEFAULT_DOMAIN']) """ if len(args) == 1 and not isinstance(args[0], basestring): args = args[0] for key in args: if not hasattr(settings, key): raise ImproperlyConfigured, "%s not defined in settings" % key