(.venv) ➜ projectGoguma (main) ✗ docker-compose exec web python manage.py createsuperuser --settings=projectGoguma.settings.dev
You have 162 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, home, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers.
Run 'python manage.py migrate' to apply them.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, 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 "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 88, in execute
return super().execute(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 109, in handle
default_username = get_default_username(database=database)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/__init__.py", line 168, in get_default_username
auth_app.User._default_manager.db_manager(database).get(
File "/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 633, in get
num = len(clone)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 380, in __len__
self._fetch_all()
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, 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...
^
이리저리 다 수정을 한 것 같은데 왜 안될까???
docker container에 직접 attach를 해보니...
엥???
(.venv) ➜ projectGoguma (main) ✗ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c281852e6c92 projectgoguma_web "/app/entrypoint.sh …" About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp projectgoguma_web_1
06f0d1750419 postgres:13.5-alpine "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp projectgoguma_db_1
59ee14bdc489 hello-world "/hello" 3 weeks ago Exited (0) 3 weeks ago gallant_lamport
(.venv) ➜ projectGoguma (main) ✗ docker attach projectgoguma_web_1
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
/app/entrypoint.sh: 7: /app/entrypoint.sh: nc: not found
nc를 왜 필요로 하지?
잘 모르겠지만 Dockerfile 에서 netcat 설치를 추가해 보니 문제 해결
# Install system packages required by Wagtail and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
libmariadbclient-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
netcat \
# environ \
# postgresql-dev \
# python3-dev \
# musl-dev \