1

I am using Ubuntu 16.04 and I installed PyCharm professional edition so I can run Django easy.

I cloned Mayan EDMS from https://gitlab.com/mayan-edms/mayan-edms and after I installed all needed packages to run it in PyCharm.

But I could not run it because I am getting error "unable to open database file".

I am new to Django and can't figure out what to do. Nothing in tutorials said about fixing this.

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
Nikola C
  • 322
  • 6
  • 22

1 Answers1

4

You need to create the initial database which in development defaults to an SQLite database. SQLite is a single file database system. Execute:

./manage.py initialsetup

This will create an initial database, migrate the schema to the latest version and fill the database with some default objects to make it usable.

Here is the link to the deployment documentation chapter of Mayan EDMS: https://docs.mayan-edms.com/chapters/deploying.html

Roberto Rosario
  • 1,818
  • 1
  • 17
  • 31
  • 1
    Thanks for response. I executed `./manage.py initialsetup` and after that I needed to execute `python manage.py collectstatic`. It all works now, but only CSS of main menu is totally broken, but that is not a big issue. – Nikola C Oct 02 '18 at 08:32
  • Thanks for the answer, it seems that the link https://docs.mayan-edms.com/en/v3.1.2/topics/development.html is broken, I hope you'll update it soon. – Ayoub Bensakhria Dec 14 '20 at 12:03
  • @AyoubBENSAKHRIA Documentation link updated. – Roberto Rosario Jan 25 '21 at 04:44