Remove the DJANGO_CONFIGURATION environment variable
There are a few issues with it: * It doesn't work for the Enterprise version, because its settings module is not located under `cvat.settings`. * The name `DJANGO_CONFIGURATION` suggests that it's defined by Django, but it isn't. It's a CVAT-specific variable. There's also a 3rd-party module that uses this variable (django-configurations), but with different semantics, which could cause confusion. * It's just redundant to have two variables that effectively do the same thing (`DJANGO_CONFIGURATION` and `DJANGO_SETTINGS_MODULE`). Besides its runtime effect, `DJANGO_CONFIGURATION` is also used in the Dockerfile to select the packages to install. I could see that still being useful, so replace it with a build-only variable named `CVAT_CONFIGURATION`.
This commit is contained in:
+4
-4
@@ -73,11 +73,11 @@ COPY utils/dataset_manifest/requirements.txt /tmp/utils/dataset_manifest/require
|
||||
# Exclude av from the requirements file
|
||||
RUN sed -i '/^av==/d' /tmp/utils/dataset_manifest/requirements.txt
|
||||
|
||||
ARG DJANGO_CONFIGURATION="production"
|
||||
ARG CVAT_CONFIGURATION="production"
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/pip/http \
|
||||
DATUMARO_HEADLESS=1 python3 -m pip wheel --no-deps \
|
||||
-r /tmp/cvat/requirements/${DJANGO_CONFIGURATION}.txt \
|
||||
-r /tmp/cvat/requirements/${CVAT_CONFIGURATION}.txt \
|
||||
-w /tmp/wheelhouse
|
||||
|
||||
FROM golang:1.20.5 AS build-smokescreen
|
||||
@@ -103,8 +103,8 @@ ENV TERM=xterm \
|
||||
TZ=${TZ}
|
||||
|
||||
ARG USER="django"
|
||||
ARG DJANGO_CONFIGURATION="production"
|
||||
ENV DJANGO_CONFIGURATION=${DJANGO_CONFIGURATION}
|
||||
ARG CVAT_CONFIGURATION="production"
|
||||
ENV DJANGO_SETTINGS_MODULE="cvat.settings.${CVAT_CONFIGURATION}"
|
||||
|
||||
# Install necessary apt packages
|
||||
RUN apt-get update && \
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
FROM cvat/server:local
|
||||
|
||||
ENV DJANGO_CONFIGURATION=testing
|
||||
ENV DJANGO_SETTINGS_MODULE=cvat.settings.testing
|
||||
USER root
|
||||
|
||||
RUN apt-get update && \
|
||||
@@ -25,7 +25,7 @@ RUN apt-get update && \
|
||||
COPY cvat/requirements/ /tmp/cvat/requirements/
|
||||
COPY utils/dataset_manifest/requirements.txt /tmp/utils/dataset_manifest/requirements.txt
|
||||
|
||||
RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/cvat/requirements/${DJANGO_CONFIGURATION}.txt
|
||||
RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/cvat/requirements/testing.txt
|
||||
|
||||
COPY cvat-core ${HOME}/cvat-core
|
||||
COPY cvat-data ${HOME}/cvat-data
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@ from django.core.handlers.asgi import ASGIHandler
|
||||
|
||||
import cvat.utils.remote_debugger as debug
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.{}" \
|
||||
.format(os.environ.get("DJANGO_CONFIGURATION", "development")))
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.development")
|
||||
|
||||
application = get_asgi_application()
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.{}" \
|
||||
.format(os.environ.get("DJANGO_CONFIGURATION", "development")))
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.development")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
|
||||
Reference in New Issue
Block a user