-
-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
I'm getting this error on python>3.12.4
In works either 3.12 or <=3.12.4
I use django-coockiecutter agconti/cookiecutter-django-rest#2409
web-1 | Postgres is ready! ✨
web-1 | + python3 manage.py migrate
web-1 | Traceback (most recent call last):
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
web-1 | res = handle_func(*args, **kwargs)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 101, in handle
web-1 | self.check(databases=[database])
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/base.py", line 486, in check
web-1 | all_issues = checks.run_checks(
web-1 | ^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/core/checks/registry.py", line 88, in run_checks
web-1 | new_errors = check(app_configs=app_configs, databases=databases)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/core/checks/model_checks.py", line 18, in check_all_models
web-1 | models = apps.get_models()
web-1 | ^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/apps/registry.py", line 181, in get_models
web-1 | self.check_models_ready()
web-1 | File "/usr/lib/python3.12/site-packages/django/apps/registry.py", line 143, in check_models_ready
web-1 | raise AppRegistryNotReady("Models aren't loaded yet.")
web-1 | django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
web-1 |
web-1 | During handling of the above exception, another exception occurred:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/usr/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 217, in _add_installed_apps_translations
web-1 | app_configs = reversed(apps.get_app_configs())
web-1 | ^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/apps/registry.py", line 147, in get_app_configs
web-1 | self.check_apps_ready()
web-1 | File "/usr/lib/python3.12/site-packages/django/apps/registry.py", line 138, in check_apps_ready
web-1 | raise AppRegistryNotReady("Apps aren't loaded yet.")
web-1 | django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
web-1 |
web-1 | During handling of the above exception, another exception occurred:
web-1 |
web-1 | Traceback (most recent call last):
web-1 | File "/app/manage.py", line 30, in <module>
web-1 | main()
web-1 | File "/app/manage.py", line 26, in main
web-1 | execute_from_command_line(sys.argv)
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
web-1 | utility.execute()
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
web-1 | self.fetch_command(subcommand).run_from_argv(self.argv)
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
web-1 | self.execute(*args, **cmd_options)
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
web-1 | output = self.handle(*args, **options)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/core/management/base.py", line 110, in wrapper
web-1 | translation.activate(saved_locale)
web-1 | File "/usr/lib/python3.12/site-packages/django/utils/translation/__init__.py", line 182, in activate
web-1 | return _trans.activate(language)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 305, in activate
web-1 | _active.value = translation(language)
web-1 | ^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 294, in translation
web-1 | _translations[language] = DjangoTranslation(language)
web-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1 | File "/usr/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 171, in __init__
web-1 | self._add_installed_apps_translations()
web-1 | File "/usr/lib/python3.12/site-packages/django/utils/translation/trans_real.py", line 219, in _add_installed_apps_translations
web-1 | raise AppRegistryNotReady(
web-1 | django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
# Opened issue https://github.com/agconti/cookiecutter-django-rest/issues/2483
FROM python:3.12.9-slim AS base
FROM base AS builder
# Allows docker to cache installed dependencies between builds
RUN apt-get update && apt-get install -y libpq-dev gcc
COPY requirements/base.txt requirements.txt
RUN pip3 install --no-cache-dir --target=packages -r requirements.txt
FROM base AS runtime
COPY --from=builder packages /usr/lib/python3.12/site-packages
ENV PYTHONPATH=/usr/lib/python3.12/site-packages
# Security Context
RUN useradd -m nonroot
USER nonroot
WORKDIR /app
COPY . .
EXPOSE 8000
Metadata
Metadata
Assignees
Labels
No labels