question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when creating superuser in fresh install

See original GitHub issue

My actions before raising this issue

  • Read/searched the docs
  • Searched past issues

Expected Behaviour

After building the docker I expect to be able to create a super user with the following command from the installation guide:

 docker exec -it cvat bash -ic 'python3 ~/manage.py createsuperuser'

Current Behaviour

Instead I get the following error message:

You have 54 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): account, admin, auth, authtoken, contenttypes, engine, git, sessions, sites, socialaccount.
Run 'python manage.py migrate' to apply them.

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...
                                                             ^


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/django/manage.py", line 21, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 61, in execute
    return super().execute(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 82, in handle
    default_username = get_default_username()
  File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/management/__init__.py", line 140, in get_default_username
    auth_app.User._default_manager.get(username=default_username)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/cacheops/query.py", line 359, in get
    return qs._no_monkey.get(qs, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 402, in get
    num = len(clone)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 256, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.5/dist-packages/cacheops/query.py", line 279, in _fetch_all
    return self._no_monkey._fetch_all(self)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 1242, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 55, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.5/dist-packages/cacheops/transaction.py", line 93, in execute
    result = self._no_monkey.execute(self, sql, params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...

Perhaps something with a database?

Possible Solution

?

Steps to Reproduce (for bugs)

  1. git clone https://github.com/opencv/cvat.git
  2. docker-compose build
  3. docker-compose up -d
  4. docker exec -it cvat bash -ic ‘python3 ~/manage.py createsuperuser’

Context

I tried this on a pc which had an older version of CVAT running without problems. I also tried it on another pc which did not have a previous install of CVAT to be sure.

Your Environment

  • Git hash commit (git log -1): image
  • Docker version docker version (e.g. Docker 17.0.05): image
  • Are you using Docker Swarm or Kubernetes? I don’t know, for sure not kubernetes.
  • Operating System and version (e.g. Linux, Windows, MacOS): image
  • Code example or link to GitHub repo or gist to reproduce problem:
  • Other diagnostic information / logs:
    Logs from `cvat` container

Next steps

You may join our Gitter channel for community support.

I also raised this issue on gitter.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
andyDoucettecommented, Aug 3, 2020

Update: A sudo chmod -R o+rX . after the git clone ... and cd cvat makes it work even if I have umask 077 as my usermask. Seems to be a permissions thing on something in the repo. I recommend finding what that thing is and maybe changing permissions in the docker container. IMHO, people should be able to have restrictive permissions in their home dir.

0reactions
iamlaurianocommented, Nov 20, 2022

This is exactly what happened to me, after changing my django files running in docker, i simply lost access to the django admin, i saw that the problem was the postgresql volume, apparently for some reason i lost the database access credentials by django, the solution: delete the images, volumes and start all over again, with the python manage.py migrate and python manage.py createsuperuser commands

Read more comments on GitHub >

github_iconTop Results From Across the Web

I get an error while trying to create superuser - Stack Overflow
I am new to Django and i am trying to create a superuser ( i'm on Linux mint) and everytime i get a...
Read more >
Django Error While Trying to Create Superuser
Run this command to install the latest version of Django. 1. pip install --upgrade django. Run the ...
Read more >
Critical error on your website. (After Fresh Install)
Right after finishing the WordPress install, I am receiving the error below when navigating to wp-admin. “There has been a critical error on...
Read more >
Troubleshoot Tableau Server Install and Upgrade
Many Tableau Server issues can be addressed with some basic steps: Make sure there is enough disk space on each computer running Tableau...
Read more >
How to create superuser in Django? - GeeksforGeeks
Django provides us Admin Panel for it's users. So we need not worry about creating a separate Admin page or providing authentication feature ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found