r4fek / django-cassandra-engine

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

Sync Issue with Tables #18

Closed robgil closed 9 years ago

robgil commented 9 years ago

Hey Folks. I've most definitely read the docs and have tried several different ways to get it to create the tables, but I just cant get it working. I've tried first, last, appended, prepended... Nothing works. This was tested with Django 1.7 but im using 1.7.3. Can you confirm this works with 1.7.3?

(rem5)[rgil@rem5-3 rem5]$ pip freeze
Cython==0.21.2
Django==1.7.3
blist==1.3.6
cassandra-driver==2.1.3
cqlengine==0.21.0
django-cassandra-engine==0.2.1
djangotoolbox==1.6.2
futures==2.2.0
pulsar==0.9.2
six==1.9.0
trollius==1.0.4
wsgiref==0.1.2

rem5/models.py

import uuid
from cqlengine import columns
from cqlengine.models import Model

class posts(Model):
    __keyspace__ = 'rem5'
    read_repair_chance = 0.05 # optional - defaults to 0.1
    post_id     = columns.UUID(primary_key=True, default=uuid.uuid4)
    title       = columns.Text(required=True)
    post        = columns.Text(required=True)
    created     = columns.DateTime()

class ExampleModel(Model):
    read_repair_chance = 0.05 # optional - defaults to 0.1
    example_id      = columns.UUID(primary_key=True, default=uuid.uuid4)
    example_type    = columns.Integer(index=True)
    created_at      = columns.DateTime()
    description     = columns.Text(required=False)

rem5/settings.py

INSTALLED_APPS = (
    'django_cassandra_engine',
    'pulsar.apps.pulse',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles'
)

Output

(rem5)[rgil@rem5-3 rem5]$ python manage.py sync_cassandra -v3
Creating keyspace rem5..
(rem5)[rgil@rem5-3 rem5]$ 

Any help would be great. This combo would be amazing (pulsar, django, cassandra).

robgil commented 9 years ago

Just tried with 1.7.0.. seeing same issue.

robgil commented 9 years ago

Sorry. Django noob. Had to add the app to the INSTALLED_APPS section. Heres the working settings for anyone else who gets hung up.

INSTALLED_APPS = (
    'pulsar.apps.pulse',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rem5',
)
INSTALLED_APPS = ('django_cassandra_engine',) + INSTALLED_APPS
r4fek commented 9 years ago

Glad to hear you solved this! Closing then.