r4fek / django-cassandra-engine

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

sync_cassandra error #115

Closed simeon4110 closed 3 years ago

simeon4110 commented 6 years ago

I'm not sure why this is happening, but I can't get the db to sync right from the start:

        strategy_class = replication_opts.pop('strategy_class',
                                              'SimpleStrategy')
        replication_factor = replication_opts.pop('replication_factor', 1)

This give me the following error:

Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2018.1.1\helpers\pycharm\django_manage.py", line 52, in run_command() File "C:\Program Files\JetBrains\PyCharm 2018.1.1\helpers\pycharm\django_manage.py", line 46, in run_command run_module(manage_file, None, 'main', True) File "C:\Users\jhark\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 205, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "C:\Users\jhark\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\jhark\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:/Users/jhark/PycharmProjects/zilker\manage.py", line 15, in execute_from_command_line(sys.argv) File "C:\Users\jhark\PycharmProjects\zilker\venv\lib\site-packages\django\core\management__init__.py", line 371, in execute_from_command_line utility.execute() File "C:\Users\jhark\PycharmProjects\zilker\venv\lib\site-packages\django\core\management__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\jhark\PycharmProjects\zilker\venv\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv self.execute(*args, *cmd_options) File "C:\Users\jhark\PycharmProjects\zilker\venv\lib\site-packages\django\core\management\base.py", line 335, in execute output = self.handle(args, **options) File "C:\Users\jhark\PycharmProjects\zilker\venv\lib\site-packages\django_cassandra_engine\management\commands\sync_cassandra.py", line 94, in handle self.sync(alias) File "C:\Users\jhark\PycharmProjects\zilker\venv\lib\site-packages\django_cassandra_engine\management\commands\sync_cassandra.py", line 64, in sync strategy_class = replication_opts('strategy_class','SimpleStrategy') TypeError: 'str' object is not callable

Process finished with exit code 1

this is the db config:

DATABASES = {
    'default': {
        'ENGINE': 'django_cassandra_engine',
        'NAME': 'db',
        'TEST_NAME': 'test_db',
        'HOST': '192.168.0.11',
        'OPTIONS': {
            'replication': 'SimpleStrategy',
            'replication_factor': 1,
        }
    }
}

Is this a 2.6 vs 3.6 issue?

r4fek commented 3 years ago

Nope. It's a configuration issue. Should be:

'OPTIONS': {
    'replication': {
        'strategy_class': 'SimpleStrategy',
        'replication_factor': 1
     }
 }