r4fek / django-cassandra-engine

Django Cassandra Engine - the Cassandra backend for Django
BSD 2-Clause "Simplified" License
362 stars 85 forks source link

admin ui #138

Open swamirara opened 4 years ago

swamirara commented 4 years ago

Issue is I am unable to apply auth migrations and could not create superuser to accces admin ui.

any sample code to to enable the admin UI? or do you have any plans to release admin auth module support?

BTW, thanks a lot for the awesome library.

Saurabh-Singh-00 commented 3 years ago

This library doesn't supports auth migration but you can do a workaround like have a sql database just for auth migrations where you can override Django user model to use UUID or email as primary key and then use cassandra database with it. Hope this helps.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    },
    'cassandra': {
        'ENGINE': 'django_cassandra_engine',
        'NAME': 'todo',
        'HOST': '172.18.0.2',
        'USER': 'cassandra',
        'PASSWORD': 'cassandra',
        'OPTIONS': {
            'replication': {
                'strategy_class': 'SimpleStrategy',
                'replication_factor': 2
            },
            'connection': {
                'consistency': ConsistencyLevel.LOCAL_QUORUM,
                'lazy_connect': True,
                'retry_connect': True,
                'port': 9042,  # default port
            }
        }
    }
}

you can then create your superuser for admin database as usual

python manage.py createsuperuser