0

I have an empty Django project (with two empty apps set in settings.py). The project is cloned from github. I need to work on it locally. It worked fine, until I tried to change username to email in user registration form. I did some modifications (don't remember which exactly, as I am stuck on this problem probably for a week or more). When I try to create superuser, i get the following error:

  Traceback (most recent call last):
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 413, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
    return super().execute(*args, **options)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 100, in handle
    default_username = get_default_username()
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/contrib/auth/management/__init__.py", line 140, in get_default_username
    auth_app.User._default_manager.get(username=default_username)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/models/query.py", line 425, in get
    num = len(clone)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/models/query.py", line 269, in __len__
    self._fetch_all()
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/models/query.py", line 1308, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql
    cursor.execute(sql, params)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/laptop/WorkProjects/Mindsum/Apps/mindsum_be/env/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 413, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: auth_user

I've seen people with the same problem in the internet, but it wasn't helpful for me.. Could anyone help me please to solve this error? The projects worked really fine, and I was able to create superuser, but after some changes (which were done on my branch) related to user registration, it stopped working. I changed my branch to "develop" branch, and from there created a new branch, with hope that with new branch I will be able to begin everything from the beginning. But the problem wasn't gone....

Mahira
  • 93
  • 1
  • 9
  • 1
    Does this answer your question? [django: User Registration with error: no such table: auth\_user](https://stackoverflow.com/questions/24682155/django-user-registration-with-error-no-such-table-auth-user) – Muteshi Dec 18 '20 at 13:01
  • 1
    use command. `python manage.py migrate` then `python manage.py createsuperuser` – harshil suthar Dec 18 '20 at 13:02

0 Answers0