taigaio / taiga-docker

Mozilla Public License 2.0
1.22k stars 305 forks source link

[Q] [docker] Warning about unapplied migrations when trying to createsuperuser during installation leads to error #88

Closed FULLBL00M closed 1 year ago

FULLBL00M commented 2 years ago

Hello Taiga enthusiasts, creators, and users !

I have no experience with this platform but I have some competence, atleast I think so lol.

Anyways, When trying to follow the 30 min install https://resources.taiga.io/30min-setup/ I have had success up to the step about creating a super user.

when I run the following command... ./taiga-manage.sh createsuperuser

I am returned a warning in red about unnapplied migrations, and then presented with a prompt to enter my username. After entering any user name the script will crash right at this step.

The warning before the username is below... You have 260 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, attachments, auth, bitbucket, contact, contenttypes, custom_attributes, djmail, easy_thumbnails, epics, external_apps, feedback, github, gitlab, gogs, history, issues, likes, milestones, notifications, projects, references, sessions, settings, tasks, telemetry, timeline, token_denylist, users, userstorage, userstories, votes, webhooks, wiki. Run 'python manage.py migrate' to apply them.

The error that it reaches after submiting the username is below...

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

Traceback (most recent call last):
  File "manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/venv/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 61, in execute
    return super().execute(*args, **options)
  File "/opt/venv/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/opt/venv/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 95, in handle
    error_msg = self._validate_username(username, verbose_field_name, database)
  File "/opt/venv/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 201, in _validate_username
    self.UserModel._default_manager.db_manager(database).get_by_natural_key(username)
  File "/opt/venv/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 44, in get_by_natural_key
    return self.get(**{self.model.USERNAME_FIELD: username})
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/query.py", line 402, in get
    num = len(clone)
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/query.py", line 256, in __len__
    self._fetch_all()
  File "/opt/venv/lib/python3.7/site-packages/django/db/models/query.py", line 1242, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/venv/lib/python3.7/site-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 "/opt/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1142, in execute_sql
    cursor.execute(sql, params)
  File "/opt/venv/lib/python3.7/site-packages/raven/contrib/django/client.py", line 127, in execute
    return real_execute(self, sql, params)
  File "/opt/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/opt/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/venv/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/venv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "users_user" does not exist
LINE 1: ...sers_user"."max_memberships_public_projects" FROM "users_use...
                                                             ^

ERROR: 1

I am sorry if this is not in the correct place, or if I am making a simple mistake. I am a bit hesitant to poke around manually since it is all automated and the setup makes it seem really simple to do quickly.

If any more information is needed please let me know :)

bameda commented 2 years ago

Hi @FULLBL00M

It seems that something was wrong with the initialization and the migrations were not applied automatically when starting the platform for the first time. Try to apply the migrations manually with the command

./taiga-manage.sh migrate

And then, if there are no errors, try again to create the superuser.

Best regards

yamila-moreno commented 1 year ago

Hi there!

Do you know that we have Taiga Community for questions? Please, check there; maybe another user has already ask something similar. If not, create your own. There are people there willing to help, members of the Taiga team members and other users.

To simplify  the process, we will systematically close all issues that are general support questions and redirect people to Taiga Community.

Taiga Team