Python Django/Cassandra:无法创建超级用户
我正在用Django和Cassandra运行Debian服务器。我无法通过以下命令创建管理员用户:Python Django/Cassandra:无法创建超级用户,python,django,cassandra,django-database,Python,Django,Cassandra,Django Database,我正在用Django和Cassandra运行Debian服务器。我无法通过以下命令创建管理员用户: python manage.py createsuperuser 运行该命令会导致错误: cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:260 no viable alternative at in
python manage.py createsuperuser
运行该命令会导致错误:
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:260 no viable alternative at input '.' (...auth_user.date_joined FROM auth_user WHERE [auth_user]....)">
完全回溯
Not checking migrations as it is not possible to access/create the django_migrations table.
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
return super(Command, self).execute(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 96, in handle
default_username = get_default_username()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/__init__.py", line 148, in get_default_username
auth_app.User._default_manager.get(username=default_username)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 379, in get
num = len(clone)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 238, in __len__
self._fetch_all()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1087, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 54, in __iter__
results = compiler.execute_sql()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django_cassandra_engine/utils.py", line 47, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django_cassandra_engine/connection.py", line 13, in execute
return self.connection.execute(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_cassandra_engine/connection.py", line 88, in execute
return self.session.execute(qs, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cassandra/cluster.py", line 1998, in execute
return self.execute_async(query, parameters, trace, custom_payload, timeout, execution_profile, paging_state).result()
File "/usr/local/lib/python2.7/dist-packages/cassandra/cluster.py", line 3781, in result
raise self._final_exception
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:260 no viable alternative at input '.' (...auth_user.date_joined FROM auth_user WHERE [auth_user]....)">
不检查迁移,因为无法访问/创建django_迁移表。
回溯(最近一次呼叫最后一次):
文件“manage.py”,第22行,在
从命令行(sys.argv)执行命令
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/__-init__;.py”,第367行,从命令行执行
utility.execute()
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/___init__.py”,执行中第359行
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/base.py”,第294行,在运行中,从
self.execute(*args,**cmd_选项)
文件“/usr/local/lib/python2.7/dist packages/django/contrib/auth/management/commands/createsuperuser.py”,执行中的第63行
返回super(命令,self).execute(*args,**选项)
文件“/usr/local/lib/python2.7/dist packages/django/core/management/base.py”,执行中第345行
输出=self.handle(*args,**选项)
文件“/usr/local/lib/python2.7/dist packages/django/contrib/auth/management/commands/createsuperuser.py”,第96行,在handle中
默认用户名=获取默认用户名()
文件“/usr/local/lib/python2.7/dist packages/django/contrib/auth/management/_init__.py”,第148行,在get\u default\u用户名中
auth\u app.User.\u default\u manager.get(用户名=默认用户名)
文件“/usr/local/lib/python2.7/dist packages/django/db/models/manager.py”,第85行,在manager\u方法中
返回getattr(self.get_queryset(),name)(*args,**kwargs)
文件“/usr/local/lib/python2.7/dist packages/django/db/models/query.py”,get中第379行
num=len(克隆)
文件“/usr/local/lib/python2.7/dist packages/django/db/models/query.py”,第238行,在__
self._fetch_all()
文件“/usr/local/lib/python2.7/dist packages/django/db/models/query.py”,第1087行,在“fetch\u all”中
self.\u result\u cache=list(self.iterator())
文件“/usr/local/lib/python2.7/dist packages/django/db/models/query.py”,第54行,在__
结果=编译器。执行_sql()
文件“/usr/local/lib/python2.7/dist packages/django/db/models/sql/compiler.py”,第835行,在execute_sql中
cursor.execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/utils.py”,执行中的第79行
返回super(CursorDebugWrapper,self).execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/utils.py”,执行中的第64行
返回self.cursor.execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django_cassandra_engine/utils.py”,执行中第47行
返回self.cursor.execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django_cassandra_engine/connection.py”,执行中的第13行
返回self.connection.execute(*args,**kwargs)
文件“/usr/local/lib/python2.7/dist packages/django_cassandra_engine/connection.py”,执行中的第88行
返回self.session.execute(qs、*args、**kwargs)
文件“/usr/local/lib/python2.7/dist packages/cassandra/cluster.py”,第1998行,在execute中
返回self.execute\u async(查询、参数、跟踪、自定义负载、超时、执行配置文件、分页状态)
结果文件“/usr/local/lib/python2.7/dist packages/cassandra/cluster.py”,第3781行
自我提升。\最终\例外
cassandra.protocol.SyntaxException:
Django Cassandra Engine v1.0.2不支持存储在Cassandra中的用户模型(身份验证模块)
解决方法是为用户模型建立第二个数据库。我们不能使用:
python manage.py createsuperuser using cassandra
它不适用于默认的django模型
您需要使用外部库来进行相同的操作
请阅读data stax上的文档或通过以下链接:
虽然这可能回答了问题,但最好解释答案的基本部分,而不是只解释链接。例如,在链接后面附加相关部件作为报价。
python manage.py createsuperuser using cassandra