Python 无法安装夹具:文件已加密或不是数据库

Python 无法安装夹具:文件已加密或不是数据库,python,json,django,fixture,loaddata,Python,Json,Django,Fixture,Loaddata,我正在开发一个网站,允许用户提名和投票不同的职位。我使用Python2.7和Django 1.10。position对象是通过django在实际服务器上的管理界面添加的。因此,我的本地服务器没有任何位置。为了发展,我想把这些职位添加到本地服务器上。我运行了命令python manage.py dumpdata voting.Position-->=2>voting/fixtures/default_positions.json。 夹具已经制作好,现在我想加载数据。当我运行python manag

我正在开发一个网站,允许用户提名和投票不同的职位。我使用Python2.7和Django 1.10。position对象是通过django在实际服务器上的管理界面添加的。因此,我的本地服务器没有任何位置。为了发展,我想把这些职位添加到本地服务器上。我运行了命令
python manage.py dumpdata voting.Position-->=2>voting/fixtures/default_positions.json
。 夹具已经制作好,现在我想加载数据。当我运行
python manage.py loaddata voting/fixtures/default_positions.json
(在我的本地目录上,而不是网站的/server目录上)时,我得到以下错误:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 64, in handle
    self.loaddata(fixture_labels)
  File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 104, in loaddata
    self.load_label(fixture_label)
  File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 167, in load_label
    obj.save(using=self.using)
  File "/usr/lib/python2.7/site-packages/django/core/serializers/base.py", line 201, in save
    models.Model.save_base(self.object, using=using, raw=True, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 824, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 889, in _save_table
    forced_update)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 939, in _do_update
    return filtered._update(values) > 0
  File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 652, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1148, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: Problem installing fixture '/home/Saleha/trabd/voting/fixtures/default_positions.json': Could not load voting.Position(pk=1): file is encrypted or is not a database
回溯(最近一次呼叫最后一次):
文件“manage.py”,第22行,在
从命令行(sys.argv)执行命令
文件“/usr/lib/python2.7/site packages/django/core/management/_init__.py”,第367行,从命令行执行
utility.execute()
文件“/usr/lib/python2.7/site packages/django/core/management/__init__.py”,执行中第359行
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“/usr/lib/python2.7/site packages/django/core/management/base.py”,第305行,在运行时从
self.execute(*args,**cmd_选项)
文件“/usr/lib/python2.7/site packages/django/core/management/base.py”,执行中第356行
输出=self.handle(*args,**选项)
文件“/usr/lib/python2.7/site packages/django/core/management/commands/loaddata.py”,第64行,在handle中
self.loaddata(夹具标签)
loaddata中的第104行文件“/usr/lib/python2.7/site packages/django/core/management/commands/loaddata.py”
自加载标签(夹具标签)
文件“/usr/lib/python2.7/site packages/django/core/management/commands/loaddata.py”,第167行,在load_标签中
对象保存(使用=自使用)
文件“/usr/lib/python2.7/site packages/django/core/serializers/base.py”,第201行,保存
models.Model.save_base(self.object,using=using,raw=True,**kwargs)
文件“/usr/lib/python2.7/site packages/django/db/models/base.py”,第824行,在save_base中
更新=自我。保存表格(原始、cls、强制插入、强制更新、使用、更新字段)
文件“/usr/lib/python2.7/site packages/django/db/models/base.py”,第889行,在保存表中
强制更新)
文件“/usr/lib/python2.7/site packages/django/db/models/base.py”,第939行,在更新中
返回已筛选的。\u更新(值)>0
文件“/usr/lib/python2.7/site packages/django/db/models/query.py”,第652行,在更新中
返回query.get_编译器(self.db)。执行_sql(游标)
文件“/usr/lib/python2.7/site packages/django/db/models/sql/compiler.py”,第1148行,在execute_sql中
cursor=super(SQLUpdateCompiler,self)。执行sql(结果类型)
文件“/usr/lib/python2.7/site packages/django/db/models/sql/compiler.py”,第835行,在execute_sql中
cursor.execute(sql,params)
文件“/usr/lib/python2.7/site packages/django/db/backends/utils.py”,执行中的第79行
返回super(CursorDebugWrapper,self).execute(sql,params)
文件“/usr/lib/python2.7/site packages/django/db/backends/utils.py”,执行中的第64行
返回self.cursor.execute(sql,params)
文件“/usr/lib/python2.7/site packages/django/db/utils.py”,第94行,在退出时__
6.重新播放(dj_exc_类型、dj_exc_值、回溯)
文件“/usr/lib/python2.7/site packages/django/db/backends/utils.py”,执行中的第64行
返回self.cursor.execute(sql,params)
文件“/usr/lib/python2.7/site packages/django/db/backends/sqlite3/base.py”,执行中的第337行
返回Database.Cursor.execute(self、query、params)
django.db.utils.DatabaseError:安装fixture“/home/Saleha/trabd/voting/fixtures/default_positions.json”时出现问题:无法加载投票。位置(pk=1):文件已加密或不是数据库
夹具文件:(此位置太长)

我还需要说,
python manage.py runserver
不起作用,
python manage.py makemigrations
;所有发生的事情都是同样的错误突然出现。 如果没有解决方案,至少有人能指导我如何撤消loaddata命令,这样至少我可以让本地服务器再次运行I吗

我为冗长的介绍道歉,但我对编程相对较新,我认为我应该尽可能多地解释。我的错误可能在最简单最愚蠢的地方


感谢您的帮助。提前感谢。

删除本地数据库:我运行了
rm db.sqlite3
,现在我可以
runserver
和所有操作。但是,原始问题仍然没有解决。要删除本地数据库:我运行了
rm db.sqlite3
,现在我可以
runserver
和所有。然而,原来的问题仍然没有得到解决。