1

I am deploying a project on PythonAnywhere. I am using sqlite database.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'mydatabase.db',
    }
}

When makemigrations starts, the file mydatabase.db is created (its size is 0 bytes) in root of the project, but I get an error - django.db.utils.OperationalError: no such table: ...

7
  • makemigrations just create migration files. You need run migrate to apply migrations to your database. See docs for details. Commented Oct 14, 2019 at 19:41
  • I get the same error Commented Oct 14, 2019 at 19:46
  • ... no such table: ... what table? Please, specify. Commented Oct 14, 2019 at 19:47
  • app_prediction Commented Oct 14, 2019 at 19:48
  • So you have app application in your project, and model Prediction in it. When you run ./manage.py makemigrations or ./manage.py migrate then you see this error. Right? Commented Oct 14, 2019 at 19:50

1 Answer 1

1

The error was due to my carelessness.

In django, views.py is performed before migrations. There was a line that ran a database query. Since the database was empty on the server, and the script was already executing a request to it, it is obvious that during the migrations I received this error.

It was enough just to delete / comment out the database request.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.