Skip to content

Commit 57c23b0

Browse files
committed
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`.
1 parent 3deadda commit 57c23b0

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ COPY utils/dataset_manifest/requirements.txt /tmp/utils/dataset_manifest/require
7373
# Exclude av from the requirements file
7474
RUN sed -i '/^av==/d' /tmp/utils/dataset_manifest/requirements.txt
7575

76-
ARG DJANGO_CONFIGURATION="production"
76+
ARG CVAT_CONFIGURATION="production"
7777

7878
RUN --mount=type=cache,target=/root/.cache/pip/http \
7979
DATUMARO_HEADLESS=1 python3 -m pip wheel --no-deps \
80-
-r /tmp/cvat/requirements/${DJANGO_CONFIGURATION}.txt \
80+
-r /tmp/cvat/requirements/${CVAT_CONFIGURATION}.txt \
8181
-w /tmp/wheelhouse
8282

8383
FROM golang:1.20.5 AS build-smokescreen
@@ -103,8 +103,8 @@ ENV TERM=xterm \
103103
TZ=${TZ}
104104

105105
ARG USER="django"
106-
ARG DJANGO_CONFIGURATION="production"
107-
ENV DJANGO_CONFIGURATION=${DJANGO_CONFIGURATION}
106+
ARG CVAT_CONFIGURATION="production"
107+
ENV DJANGO_SETTINGS_MODULE="cvat.settings.${CVAT_CONFIGURATION}"
108108

109109
# Install necessary apt packages
110110
RUN apt-get update && \

Dockerfile.ci

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM cvat/server:local
22

3-
ENV DJANGO_CONFIGURATION=testing
3+
ENV DJANGO_SETTINGS_MODULE=cvat.settings.testing
44
USER root
55

66
RUN apt-get update && \
@@ -25,7 +25,7 @@ RUN apt-get update && \
2525
COPY cvat/requirements/ /tmp/cvat/requirements/
2626
COPY utils/dataset_manifest/requirements.txt /tmp/utils/dataset_manifest/requirements.txt
2727

28-
RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/cvat/requirements/${DJANGO_CONFIGURATION}.txt
28+
RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/cvat/requirements/testing.txt
2929

3030
COPY cvat-core ${HOME}/cvat-core
3131
COPY cvat-data ${HOME}/cvat-data

cvat/asgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
import cvat.utils.remote_debugger as debug
2020

21-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.{}" \
22-
.format(os.environ.get("DJANGO_CONFIGURATION", "development")))
21+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.development")
2322

2423
application = get_asgi_application()
2524

manage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import sys
99

1010
if __name__ == "__main__":
11-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.{}" \
12-
.format(os.environ.get("DJANGO_CONFIGURATION", "development")))
11+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.development")
1312
try:
1413
from django.core.management import execute_from_command_line
1514
except ImportError as exc:

0 commit comments

Comments
 (0)