title: django.db.utils.DatabaseError: file is not a database
body: <pre><code>Watching for file changes with StatReloader
  Performing system checks...
  System check identified no issues (0 silenced).
  Exception in thread django-main-thread:
  Traceback (most recent call last):
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\utils.py&quot;, line 82, in _execute
      return self.cursor.execute(sql)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\sqlite3\base.py&quot;, line 411, in execute
      return Database.Cursor.execute(self, query)
  sqlite3.DatabaseError: file is not a database
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\threading.py&quot;, line 932, in _bootstrap_inner
      self.run()
    File &quot;C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\threading.py&quot;, line 870, in run
      self._target(*self._args, **self._kwargs)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\utils\autoreload.py&quot;, line 53, in wrapper
      fn(*args, **kwargs)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\core\management\commands\runserver.py&quot;, line 121, in inn
  er_run
      self.check_migrations()
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\core\management\base.py&quot;, line 459, in check_migrations
      executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\migrations\executor.py&quot;, line 18, in __init__
      self.loader = MigrationLoader(self.connection)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\migrations\loader.py&quot;, line 53, in __init__
      self.build_graph()
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\migrations\loader.py&quot;, line 216, in build_graph
      self.applied_migrations = recorder.applied_migrations()
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\migrations\recorder.py&quot;, line 77, in applied_migratio
  ns
      if self.has_table():
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\migrations\recorder.py&quot;, line 56, in has_table
      tables = self.connection.introspection.table_names(cursor)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\base\introspection.py&quot;, line 48, in table_na
  mes
      return get_names(cursor)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\base\introspection.py&quot;, line 43, in get_name
  s
      return sorted(ti.name for ti in self.get_table_list(cursor)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\sqlite3\introspection.py&quot;, line 74, in get_t
  able_list
      cursor.execute(&quot;&quot;&quot;
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\utils.py&quot;, line 98, in execute
      return super().execute(sql, params)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\utils.py&quot;, line 66, in execute
      return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\utils.py&quot;, line 75, in _execute_with_wrapper
  s
      return executor(sql, params, many, context)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\utils.py&quot;, line 84, in _execute
      return self.cursor.execute(sql, params)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\utils.py&quot;, line 90, in __exit__
      raise dj_exc_value.with_traceback(traceback) from exc_value
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\utils.py&quot;, line 82, in _execute
      return self.cursor.execute(sql)
    File &quot;C:\Users\user\PycharmProjects\myweb\venv\lib\site-packages\django\db\backends\sqlite3\base.py&quot;, line 411, in execute
      return Database.Cursor.execute(self, query)
  django.db.utils.DatabaseError: file is not a database
  
  </code></pre>
  <p>First, the error is &quot;DatabaseError: database disk image is malformed&quot;.</p>
  <p>The db.sqlite3 file was deleted and re-created and then copied and pasted. Then that kind of error occurs.</p>
  <p>What do i do?</p>