Closed lrhazi closed 10 years ago
You have to add at least one CQL model in django application, which has to be added to INSTALLED_APPS. Then run syncdb and your model(s) should be synced automatically. Good luck!
I believe I did that... I added the model as in the wiki : class ExampleModel(Model)
Is that not what you mean?
In case it matters:
➜ ~ sudo pip list |egrep -i 'cass|djan' cassandra-driver (2.1.0) Django (1.7) django-cassandra-engine (0.0.6) django-celery (3.1.16) django-celery-with-redis (3.0) django-jinja (1.0.4) djangorestframework (2.4.3) djangotoolbox (1.6.2)
Could you paste your models.py here? Are you sure this app is in INSTALLED_APPS?
It's same as the wiki, and my app was added to INSTALLED_APPS automatically by PyCharm... I did double check :)
import uuid from cqlengine import columns from cqlengine.models import Model
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)
You're doing something wrong. Take a look at testproject in this repo. It works for sure on Django 1.7. We're using this engine in many projects without any problems..
I am sure I am.. I'll try and start from the test project. Thanks a lot.
No problem. Let me know when you solve it. Good luck!
@lrhazi have you resolved your issue?
sorry know. have not had time to dig into it further. feel free to close since nobody else seems to be reproducing my issues.
I had this issue as well, until I looked at the example and noticed that django_cassandra_engine was the very last app in INSTALLED_APPS. After adjusting my list accordingly, syncdb created the tables defined in my app. This ordering dependency should perhaps be more explicitly stated in the docs.
@wryfi but it is! The docs says: IMPORTANT: This app should be last on INSTALLED_APPS list.
I had this issue. But I solved it. Please try ./manage.py syncdb --database cassandra
. cassandra
is your cassandra database name in settings.py
.
My code is below.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
},
'cassandra': {
'ENGINE': 'django_cassandra_engine',
'NAME': 'db',
'TEST_NAME': 'test_db',
'HOST': '127.0.0.1',
'OPTIONS': {
'replication': {
'strategy_class': 'SimpleStrategy',
'replication_factor': 1
}
}
}
}
http://r4fek.github.io/django-cassandra-engine/faq/
The doc says it should be first application. But for me neither making it first or last working.
Following the 4 steps in the wiki, when I run syncdb I only see: Creating keyspace avesterra_db..
Should there be something else created, given the one example model ?