【问题标题】:unable to create superuser in python Django无法在 python Django 中创建超级用户
【发布时间】:2023-03-13 22:07:01
【问题描述】:

我已阅读 Stackoverflow 中的问题并在 Google 上搜索过,但没有运气。

我正在尝试在 pycharm 中创建一个超级用户(manage.py createsuperuser ) 但出现以下错误:

"cassandra.protocol.SyntaxException:"

Not checking migrations as it is not possible to access/create the django_migrations table.
Traceback (most recent call last):
  File "C:\Users\skum\PQP_Bridge\manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Python27\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 63, in execute
    return super(Command, self).execute(*args, **options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 96, in handle
    default_username = get_default_username()
  File "C:\Python27\lib\site-packages\django\contrib\auth\management\__init__.py", line 148, in get_default_username
    auth_app.User._default_manager.get(username=default_username)
  File "C:\Python27\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 374, in get
    num = len(clone)
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 232, in __len__
    self._fetch_all()
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "C:\Python27\lib\site-packages\django\db\models\query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py", line 894, in execute_sql
    raise original_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]....)">

我做错了什么?

我正在使用 Cassandra 3.0、Python Django 1.11.4 和 pycharm。

【问题讨论】:

  • 发布完整的回溯
  • 我已编辑有问题。有帮助吗?

标签: django pycharm cassandra-3.0


【解决方案1】:

我们不能使用:python manage.py createsuperuser using Cassandra 它不适用于默认的 django 模型。您需要使用外部库。默认情况下,用户模块不适用于 Cassandra

请阅读有关 data-stax 或以下给定链接的文档。 https://pypi.python.org/pypi/django-cassandra-engine/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-11
    • 2012-12-13
    • 2017-06-27
    • 2021-08-19
    • 1970-01-01
    • 2016-03-17
    • 2015-12-08
    相关资源
    最近更新 更多