错误:AttributeError:在django中运行“python manage.py syncdb”时,’super’对象没有属性’db_type’
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了错误:AttributeError:在django中运行“python manage.py syncdb”时,’super’对象没有属性’db_type’,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1947字,纯文字阅读大概需要3分钟。
内容图文
![错误:AttributeError:在django中运行“python manage.py syncdb”时,’super’对象没有属性’db_type’](/upload/InfoBanner/zyjiaocheng/723/2d8df32b723d4de7a5015c859b71389b.jpg)
我正在开发一个django项目,我有两个数据库“mysql”和“neo4j”.我安装neo4django包并更改如下的setting.py:
setting.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mylifetime',
'USER': 'root',
'PASSWORD': 'mypassword',
'HOST': '',
'PORT': '',
}
}
NEO4J_DATABASES = {
'default' : {
'HOST':'localhost',
'PORT':7474,
'ENDPOINT':'/db/data'
}
}
我的模特目前只有neo4j型号:
models.py:
from neo4django.db import models
class User(models.NodeModel):
...
#my User models ...
....
class Post(models.NodeModel):
...
#my Post models
...
当我运行此命令python manage.py syncdb我收到错误:
$python ../manage.py syncdb
Creating tables ...
AttributeError: 'super' object has no attribute 'db_type'
当我只使用MySql模型时,我没有看到错误,表格将成功创建.
我哪里错了?
谢谢
编辑:
当我写python manage.py syncdb –traceback时,我看到如下:
Creating tables ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 222, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 255, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 385, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 91, in handle_noargs
sql, references = connection.creation.sql_create_model(model, self.style, seen_models)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/creation.py", line 50, in sql_create_model
col_type = f.db_type(connection=self.connection)
File "/usr/local/lib/python2.7/dist-packages/neo4django-0.1.8-py2.7.egg/neo4django/utils.py", line 303, in __getattr__
return getattr(target, name)
AttributeError: 'super' object has no attribute 'db_type'
解决方法:
使用–traceback选项manage.py查看您获得的异常的完整堆栈跟踪.
内容总结
以上是互联网集市为您收集整理的错误:AttributeError:在django中运行“python manage.py syncdb”时,’super’对象没有属性’db_type’全部内容,希望文章能够帮你解决错误:AttributeError:在django中运行“python manage.py syncdb”时,’super’对象没有属性’db_type’所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。