Django: OperationalError at /admin/

Viewed 28695

So I ran my program based on from here and It worked without any error. I go to to /admin. I login. So far everything is good. Then when it loads I get this:

Error Code

I checked the traceback (which is really long) and none of includes my code. It doesn't tell me what part of the code this error is occurring in so I don't know how to approach this. Please explain what this is, why this is happening, and how I can fix it.

If you need any part of my code, just ask in comments because I don't know where this is happening.

10 Answers

Use pip install django==2.1.5

If the problem persists,

Use python manage.py migrate --run-syncdb

  • by default, the auth table is not created in the database
  • so first we need to create the table and reload the page

to achieve the same

make the migrations by typing the following command

        1. python3 manage.py makemigrations
        2. python3 manage.py migrate

Till the time they don't debug this issue with Django and Sqlite3 use the older versions of Django You may consider using version 1.10.5(using command pip install --upgrade django==1.10.5)

yes, that was fault of django version ,when i installed django==2.1.5 that problem was solved.

Install latest django version

$ pip3 install django==2.2.8
$ python3 manage.py makemigrations
$ python manage.py migrate

then reload page in browser

this is the problem with migration just type the following command:-

python manage.py migrate

If you still get error after you lunched

python manage.py migrate

and for every change you made on models

python manage.py makemigrations
python manage.py migrate

Then check if you have Django version older than 2.1.5, because this latter version fixes a bug returning "OperationalError>no such table" when adding an object to your database as superuser. So try to

pip install Django==2.1.5

However, you will have to re-write your project anew.

user permission

Hi In Django Administration :check if the user has the right permission, it should work

use these commands

python3 manage.py makemigrations

python3 manage.py migrate

python3 manage.py runserver

Related