Skip to content

Commit

Permalink
Merge branch 'venv-caching-multiple-envs' into 'master'
Browse files Browse the repository at this point in the history
Support multiple envs with env caching

See merge request thorgate-public/django-project-template!263
  • Loading branch information
Jyrno42 committed Aug 5, 2022
2 parents 388abdc + da046a3 commit 53b022b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions {{cookiecutter.repo_name}}/Dockerfile-django.production
Expand Up @@ -29,8 +29,7 @@ ENV POETRY_NO_INTERACTION 1
ENV POETRY_VIRTUALENVS_CREATE 0
ENV PATH="$POETRY_HOME/bin:$PATH"

RUN wget https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py && \
python3 get-poetry.py
RUN wget -O - -o /dev/null https://install.python-poetry.org | python3 -

COPY pyproject.toml /
COPY poetry.lock /
Expand Down
Expand Up @@ -28,8 +28,7 @@ ENV POETRY_NO_INTERACTION 1
ENV POETRY_VIRTUALENVS_CREATE 0
ENV PATH="$POETRY_HOME/bin:$PATH"

RUN wget https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py && \
python3 get-poetry.py
RUN wget -O - -o /dev/null https://install.python-poetry.org | python3 -

COPY pyproject.toml /
COPY poetry.lock /
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.repo_name}}/pyproject.toml
Expand Up @@ -104,6 +104,7 @@ exclude = '''
| build
| dist
| docs
| cover
)/
| local.py
| local_test.py
Expand Down
3 changes: 2 additions & 1 deletion {{cookiecutter.repo_name}}/scripts/django-dev-entrypoint.sh
Expand Up @@ -59,7 +59,8 @@ fi
if [[ "${DPT_VENV_CACHING}" -eq "1" ]]; then
reported_path=$(poetry env list | cut -f 1 -d ' ')

if [[ "${reported_path}" != "${ENV_FOLDER}" ]]; then
# Bail out if ENV_FOLDER does not match reported_path or if it does not exists in the poetry env list (when multiple are available).
if [[ "${reported_path}" != "${ENV_FOLDER}" ]] && [[ $reported_path != *"${ENV_FOLDER}"* ]]; then
echo "The env folder path does not match ENV_FOLDER setting. Please update ENV_FOLDER"
echo " in Dockerfile-django."
echo ""
Expand Down
Expand Up @@ -9,6 +9,7 @@ ignore-paths:
ignore-patterns:
- migrations/
- htmlcov/
- cover/

pycodestyle:
enable:
Expand Down
Expand Up @@ -13,6 +13,13 @@ warn_redundant_casts = True
warn_unused_configs = True
warn_unreachable = True
warn_no_return = True
exclude = (?x)(
local\.py$
| local_test\.py$
| test_(.+)
| tests\.py
| tests
)

plugins =
mypy_django_plugin.main,
Expand Down

0 comments on commit 53b022b

Please sign in to comment.