Django-OperationalError-尝试编写只读数据库

时间:2019-10-03 15:12:56

标签: django

我不得不更改模型名称,现在出现此错误:

Traceback:

File "/usr/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/django/django_project/personal/views.py" in delete_mobile
  134.     Chart.objects.filter(id=pk).delete()

File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in delete
  617.         deleted, _rows_count = collector.delete()

File "/usr/lib/python2.7/dist-packages/django/db/models/deletion.py" in delete
  284.                 count = qs._raw_delete(using=self.using)

File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in _raw_delete
  631.         return sql.DeleteQuery(self.model).delete_qs(self, using)

File "/usr/lib/python2.7/dist-packages/django/db/models/sql/subqueries.py" in delete_qs
  80.         cursor = self.get_compiler(using).execute_sql(CURSOR)

File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql
  899.             raise original_exception

Exception Type: OperationalError at /mobiles/delete/135
Exception Value: attempt to write a readonly database

我试图重置数据库,但没有帮助,我该怎么办?

谢谢您的帮助

1 个答案:

答案 0 :(得分:0)

通过以下方式解决:

sudo chmod a + w db.sqlite3