Integrating cryptoassets.core library in django

22 views
Skip to first unread message

Hitesh Goyal

unread,
May 2, 2018, 7:10:31 AM5/2/18
to Django users
Hi, 
I am trying to configure the cryptoassets.core library for bitcoin applications using the following url : -
 
When i run the command :- 

"python manage.py cryptoassets_helper_service" I am getting the following error :- 

ImportError: No module named 'cryptoassets.core.backend.sochainwalletnotify'

I want to ask where and how to configure the cryptoassets_helper_service. Please suggest how can i integrate the library.

Mario R. Osorio

unread,
May 2, 2018, 11:25:11 AM5/2/18
to Django users
You need to give more details, such as:

  • Did you PIP the application?
  • Did you remember to add it to INSTALLED_APPS?

Hitesh Goyal

unread,
May 2, 2018, 11:18:23 PM5/2/18
to Django users
Yes I did.
1) I installed all the required packages.
2) Added to Installed apps.

Here is my settings.py file :-  

"""
Django settings for crypto project.

Generated by 'django-admin startproject' using Django 2.0.

For more information on this file, see

For the full list of settings and their values, see
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'll8(-7j1l%$xmr269^s1%k(wkdki72zd=ngg@$mnr5-ac!%_8-'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'cryptoassets.django',  
    'cryptoassets.core',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'crypto.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'crypto.wsgi.application'


# Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'


# TESTNET settings
CRYPTOASSETS = {

    # It is recommended to use separate database for cryptoassets,
    # but you can share the database with Django as well.
    # In any case, cryptoassets
    # will use a separate db connection.
    # cryptoassets.django does not read the existing DATABASES setting.
    # Configure the connection using SQLAlchemy syntax:
    "database": {
        "url": "postgresql:///cryptoassets",
        "echo": False,
    },

    # Configure block.io API service with Bitcoin testnet
    # (let's not play around with real Bitcoins yet)
    "coins": {
        "btc": {
            "backend": {
                "class": "cryptoassets.core.backend.blockio.BlockIo",
                "api_key": "887c-1a48-6c1f-ev64",
                "network": "btctest",
                "pin": "icemanuser",
                # Cryptoassets helper process will use this UNIX named pipe to communicate
                # with bitcoind
                "walletnotify": {
                    "class": "cryptoassets.core.backend.sochainwalletnotify.SochainWalletNotifyHandler",
                    "pusher_app_key": "e9f5cc20074501ca7395"
                },
            }
        },
    },

    # Bind cryptoassets.core event handler to Django dispacth wrapper
    "events": {
        "django": {
            "class": "cryptoassets.core.event.python.InProcessEventHandler",
            "callback": "cryptoassets.django.incoming.handle_tx_update"
        }
    },

    # Start simple status at port 9001 for diagnostics
    "status_server": {
        "ip": "127.0.0.1",
        "port": 9001
Reply all
Reply to author
Forward
0 new messages