无法在Django网站中添加到postgresql

时间:2015-02-27 19:14:43

标签: python django postgresql

必须使用旧版本的Python& Django,我正在尝试同步postgresql,这是我得到的错误。试图找到错误的起源或其他可能的方法试图让它工作,我知道这只是错误,但任何帮助非常感谢。

追踪(最近一次通话):   文件“manage.py”,第11行,in     execute_manager(设置)   在execute_manager中输入文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/init.py”,第362行     utility.execute()   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/init.py”,第303行,执行     self.fetch_command(子命令).run_from_argv(self.argv)   在run_from_argv中输入文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/base.py”,第195行     self.execute(* args,** options。 dict )   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/base.py”,第222行,执行     output = self.handle(* args,** options)   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/base.py”,第351行,句柄     return self.handle_noargs(**选项)   在handle_noargs中输入文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/commands/syncdb.py”,第100行     emit_post_sync_signal(created_models,verbosity,interactive)   在emit_post_sync_signal中输入文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/management/sql.py”,第205行     交互式=交互式)   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/dispatch/dispatcher.py”,第166行,发送     response = receiver(signal = self,sender = sender,** named)   在create_initial_revisions中的文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/reversion/management/init.py”,第45行     version_save(unversioned_obj)   在_create_on_success中输入文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/reversion/revisions.py”,第326行     self.end()   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/reversion/revisions.py”,第283行,最后     serialized_data = serializers.serialize(registration_info.format,[obj],fields = registration_info.fields)   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/serializers/init.py”,第87行,序列化     s.serialize(queryset,** options)   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/serializers/base.py”,第47行,序列化     self.handle_fk_field(obj,field)   在handle_fk_field中输入文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/core/serializers/python.py”,第48行     related = getattr(obj,field.name)   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/db/models/fields/related.py”,第257行,获取     rel_obj = QuerySet(self.field.rel.to).get(** params)   文件“/Users/mac/nsa_needtoknow/venv/lib/python2.6/site-packages/django/db/models/query.py”,第306行,获取     %self.model._meta.object_name) django.contrib.contenttypes.models.DoesNotExist:ContentType匹配查询不存在。

编辑:这是Django 1.1.4 ......

1 个答案:

答案 0 :(得分:1)

如果您使用的是Django> 1.7尝试:

./manage.py makemigrations  
./manage.py migrate 

如果它是旧版本的django,你需要确保你有contrib.contenttypes(我不确定哪个是第一个带有contenttypes的Django版本)然后运行:./ manage.py syncdb