gpt4 book ai didi

django - 无法使用 Django 和 mongoDB 运行 syncdb

转载 作者:可可西里 更新时间:2023-11-01 10:44:40 28 4
gpt4 key购买 nike

我从 github 上获取了 django-nonreldjangotoolboxmongodbenginesetting.py 如下以下:

DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'admin', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
)

ROOT_URLCONF = 'ptl.urls'

TEMPLATE_DIRS = ('/Users/bxshi/PycharmProjects/ptl/templates',)

INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
)

除了settings.py,我的项目中没有任何其他.py文件。

我得到的错误是:

BaoxuShis-MacBook:ptl bxshi$ python manage.py syncdb
Creating tables ...
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/Library/Python/2.7/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/Library/Python/2.7/site-packages/django/contrib/contenttypes/management.py", line 11, in update_contenttypes
content_types = list(ContentType.objects.filter(app_label=app.__name__.split('.')[-2]))
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 84, in __len__
self._result_cache.extend(self._iter)
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 275, in iterator
for row in compiler.results_iter():
File "build/bdist.macosx-10.7-intel/egg/djangotoolbox/db/basecompiler.py", line 335, in results_iter
File "build/bdist.macosx-10.7-intel/egg/djangotoolbox/db/basecompiler.py", line 430, in build_query
File "build/bdist.macosx-10.7-intel/egg/django_mongodb_engine/compiler.py", line 160, in add_filters
File "build/bdist.macosx-10.7-intel/egg/django_mongodb_engine/compiler.py", line 168, in add_filters
ValueError: need more than 3 values to unpack

我发现了一些与 mongodbengine 相关的错误,BBS 上的一个帖子讨论了这个问题,但它说这已经修复了。

最佳答案

只需使用 https://django-mongodb-engine.readthedocs.org/en/latest/topics/setup.html 上的官方安装说明即可。

关于django - 无法使用 Django 和 mongoDB 运行 syncdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10513795/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com