def ready(self): config = getattr(settings, "CRYPTOASSETS", None) if not config: raise RuntimeError( "You need to have CRYPTOASSETS configuration dictionary in your Django settings.py" ) self.cryptoassets = CryptoAssetsApp() self.configurator = Configurator(self.cryptoassets) self.configurator.load_from_dict(config) self.cryptoassets.setup_session()
class CryptoassetsConfig(AppConfig): name = 'cryptoassets.django' verbose_name = "Cryptoassets library integration for Django" def ready(self): config = getattr(settings, "CRYPTOASSETS", None) if not config: raise RuntimeError("You need to have CRYPTOASSETS configuration dictionary in your Django settings.py") self.cryptoassets = CryptoAssetsApp() self.configurator = Configurator(self.cryptoassets) self.configurator.load_from_dict(config) self.cryptoassets.setup_session()
class CryptoassetsConfig(AppConfig): name = 'cryptoassets.django' verbose_name = "Cryptoassets library integration for Django" def ready(self): config = getattr(settings, "CRYPTOASSETS", None) if not config: raise RuntimeError( "You need to have CRYPTOASSETS configuration dictionary in your Django settings.py" ) self.cryptoassets = CryptoAssetsApp() self.configurator = Configurator(self.cryptoassets) self.configurator.load_from_dict(config) self.cryptoassets.setup_session()
def ready(self): config = getattr(settings, "CRYPTOASSETS", None) if not config: raise RuntimeError("You need to have CRYPTOASSETS configuration dictionary in your Django settings.py") self.cryptoassets = CryptoAssetsApp() self.configurator = Configurator(self.cryptoassets) self.configurator.load_from_dict(config) self.cryptoassets.setup_session()
from cryptoassets.core.app import CryptoAssetsApp from cryptoassets.core.configure import Configurator from cryptoassets.core.utils.httpeventlistener import simple_http_event_listener from cryptoassets.core.models import NotEnoughAccountBalance # Because we are using a toy database and toy money, we ignore this SQLLite database warning warnings.filterwarnings( 'ignore', r"^Dialect sqlite\+pysqlite does \*not\* support Decimal objects natively\, " "and SQLAlchemy must convert from floating point - rounding errors and other " "issues may occur\. Please consider storing Decimal numbers as strings or " "integers on this platform for lossless storage\.$", SAWarning, r'^sqlalchemy\.sql\.type_api$') assets_app = CryptoAssetsApp() # This will load the configuration file for the cryptoassets framework # for the same path as examply.py is conf_file = os.path.join(os.path.dirname(__file__), "example.config.yaml") configurer = Configurator(assets_app) configurer.load_yaml_file(conf_file) # This will set up SQLAlchemy database connections, as loaded from # config. It's also make assets_app.conflict_resolver available for us assets_app.setup_session() # This function will be run in its own background thread, # where it runs mini HTTP server to receive and process # any events which cryptoassets service sends to our