django.conf.ImproperlyConfigured - python examples

Here are the examples of the python api django.conf.ImproperlyConfigured taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : coinpayments.py
Copyright MIT License
Author : Bearle
    @clastmethod
    def get_instance(cls):
        """
        Checks Django settings for api keys & IPN url and
        returns and initialized instance of `CoinPayments`
        """
        if not getattr(settings, 'COINPAYMENTS_API_KEY', None) or \
           not getattr(settings, 'COINPAYMENTS_API_SECRET', None):
            raise ImproperlyConfigured('COINPAYMENTS_API_KEY and COINPAYMENTS_API_SECRET are required!')
        ipn_url = getattr(settings, 'COINPAYMENTS_IPN_URL', None)
        if ipn_url:
            if not getattr(settings, 'COINPAYMENTS_IPN_SECRET', None) or \
               not getattr(settings, 'COINPAYMENTS_MERCHANT_ID', None):
                raise ImproperlyConfigured('COINPAYMENTS_IPN_SECRET and '
                                           'COINPAYMENTS_MERCHANT_ID are required if IPN is turned on!')
        return CoinPayments(settings.COINPAYMENTS_API_KEY, settings.COINPAYMENTS_API_SECRET, ipn_url=ipn_url)