Detect if an incompatible DJANGO_SETTINGS_MODULE is set
evildmp opened this issue · comments
With:
pip==10.0.1
Python==3.5.2
- in a Docker environment
the startproject
command exits with a status 1:
subprocess.CalledProcessError: Command '['/srv/linsci/env/bin/python3.5', '/srv/linsci/env/bin/django-admin.py', 'startproject', 'django_cms', '/srv/linsci/src/website/django_cms']' returned non-zero exit status 1
However the same user @mnieber reports that it works on the host on the same machine.
In addition, with pip==10.0.1
, a warning is raised about the combination:
Django==1.11.13
djangocms-column==1.7.0
djangocms-column 1.7.0 has requirement django<1.10,>=1.8, but you'll have django 1.11.13 which is incompatible.
It's not clear yet whether the warning is related to the error (I can reproduce the warning, but not the error).
See also django-cms/djangocms-column#36 (comment).
From django-cms/djangocms-column#36:
In the docker environment, I had DJANGO_SETTINGS_MODULE defined (to a value that is not compatible with the djangocms project layout) [that caused this issue].
I guess this problem could be detected early by letting djangocms-installer check that there is no DJANGO_SETTINGS_MODULE environment variable pointing to the wrong value.
setup.py
from pypi package (https://files.pythonhosted.org/packages/65/46/3926c8df842ca80cdd7fd72fc840da797de68abe6acaf49d9723aba36f46/djangocms-column-1.7.0.tar.gz, wheel has the same issue) has the following requirements
INSTALL_REQUIRES = [
'django-cms>=3.2.0',
'django>=1.8,<1.10',
]
I cannot reproduce the failure using the followin Dockerfile
FROM python:3.5
ENV PYTHONUNBUFFERED=1 \
PIP_REQUIRE_VIRTUALENV=false \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8 \
PYTHONPATH=/app/src:$PYTHONPATH
RUN apt-get update
RUN apt-get install -y --force-yes --no-install-recommends net-tools redis-tools vim gettext
# Project root
RUN mkdir /app
# All development apps will be mounted in /contrib
RUN mkdir /contrib
WORKDIR /app
RUN pip install "Django>=1.11,<1.11.999" "pip>10"
RUN pip install djangocms-installer
# Creates project directory inside app
RUN djangocms -f -p . project --cms-version=3.5
@yakky Please see the comment above: it's related to the existence of a DJANGO_SETTINGS_MODULE environment variable (pointing to a value that is incompatible with the django_cms project layout)
@mnieber how about forcing a compatible DJANGO_SETTINGS_MODULE
during the installer run? (I missed the second comment by daniele as I already made the tests before he posted his comment and then I posted mine a few hours after without being aware of his second comment)
@yakky Yes, that sounds good! If the DJANGO_SETTINGS_MODULE
value is not compatible, the installer can stop with an error.