8

I have developed a Django powered web-pages where I am storing pretty much all content inside a database, let's say sqlite.db

Django properly reads all information from the database and displays the webpage correctly.

Using the admin interface however (on the production server -> the development server coming with the pydev plugin from Eclipse is working fine) the database cannot be accessed. If I just copy the database file it tells me it cannot read and I don't even get the log-on screen to the admin app of django. If I change the file and directory permissions as suggested in many forums I am getting the admin login screen, however django returns the "DatabaseError at /admin/ - database disk image is malformed" Error.

I am using Django 1.6.5 and sqlite3 3.7.13

Any ideas?

EDIT: I found out that only the main page of the django admin interface is affected. I can navigate to the app settings with no problems.

EvilSmurf
  • 819
  • 1
  • 7
  • 21
  • I found out that the django admin server run on the target system (raspberryPi debian-weezy) does not work as well (database malformed). On windows it does – EvilSmurf Sep 22 '14 at 16:50
  • 1
    This might help: http://stackoverflow.com/questions/5274202/sqlite3-database-or-disk-is-full-the-database-disk-image-is-malformed – joel goldstick Sep 22 '14 at 16:56
  • Thank you joel for the hint, but the database works fine in my development environment and I am making sure not to copy a database in use. I will try to create a new database on my target system and then just copy the information – EvilSmurf Sep 24 '14 at 12:37
  • After reading more carefully I found a solution, thanks to joel. http://askubuntu.com/questions/30185/banshee-encountered-a-fatal-error-sqlite-error-11-database-disk-image-is-malfo did the trick! Thank you again! – EvilSmurf Sep 24 '14 at 15:54

2 Answers2

9

Only three steps.

  1. delete db.sqlite3 and all migrations files
  2. run python manage.py makemigrations
  3. run python manage.py migrate
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
vikas thakur
  • 132
  • 1
  • 4
5

As Joel pointed out "SQLite3 database or disk is full / the database disk image is malformed" has a solution in its comment sections (https://askubuntu.com/questions/30185/banshee-encountered-a-fatal-error-sqlite-error-11-database-disk-image-is-malfo). Thank you Joel Goldstick for the help!

Community
  • 1
  • 1
EvilSmurf
  • 819
  • 1
  • 7
  • 21