无法打开数据库文件-Mayan EDMS

时间:2018-09-24 12:10:53

标签: python django linux database python-3.x

我正在使用Ubuntu 16.04,并且安装了PyCharm专业版,因此​​可以轻松运行Django。

我从https://gitlab.com/mayan-edms/mayan-edms克隆了Mayan EDMS 然后我安装了所有必需的软件包,以便在PyCharm中运行它。

但是我无法运行它,因为出现错误“无法打开数据库文件”。

我是Django新手,不知道该怎么做。教程中没有任何关于修复此问题的内容。

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f9fbe9438c8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/base.py", line 198, in get_new_connection
    conn = Database.connect(**conn_params)
sqlite3.OperationalError: unable to open database file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 127, in inner_run
    self.check_migrations()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 422, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 20, in _init_
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 52, in _init_
    self.build_graph()
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/loader.py", line 209, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 94, in _exit_
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.5/dist-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/base.py", line 198, in get_new_connection
    conn = Database.connect(**conn_params)
django.db.utils.OperationalError: unable to open database file

1 个答案:

答案 0 :(得分:1)

您需要创建初始数据库,该数据库在开发中默认为SQLite数据库。 SQLite是单个文件数据库系统。执行:

./manage.py initialsetup

这将创建一个初始数据库,将架构迁移到最新版本,并使用一些默认对象填充数据库以使其可用。

以下是Mayan EDMS开发文档章节的链接:https://docs.mayan-edms.com/en/v3.1.2/topics/development.html