Skip to content

Commit

Permalink
Merge pull request #2649 from ohcnetwork/sainak/fix-dev-docker-image
Browse files Browse the repository at this point in the history
fix dev docker file and enable sql logging
  • Loading branch information
vigneshhari authored Dec 11, 2024
2 parents 2b4f1dd + 21181ce commit 88de800
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
# django-silk
# ------------------------------------------------------------------------------
# https://github.com/jazzband/django-silk#requirements
INSTALLED_APPS += ["silk"]
MIDDLEWARE += ["silk.middleware.SilkyMiddleware"]
if env("ENABLE_SILK", default=False):
INSTALLED_APPS += ["silk"]
MIDDLEWARE += ["silk.middleware.SilkyMiddleware"]
# https://github.com/jazzband/django-silk#profiling
SILKY_PYTHON_PROFILER = True

Expand Down
3 changes: 2 additions & 1 deletion docker/.local.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ DATABASE_URL=postgres://postgres:postgres@db:5432/care
REDIS_URL=redis://redis:6379
CELERY_BROKER_URL=redis://redis:6379/0

DJANGO_DEBUG=False
DJANGO_DEBUG=true
ATTACH_DEBUGGER=false

BUCKET_REGION=ap-south-1
BUCKET_KEY=key
Expand Down
4 changes: 2 additions & 2 deletions docker/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ RUN ARCH=$(dpkg --print-architecture) && \
rm -rf typst.tar.xz typst-${TYPST_ARCH}

# use pipenv to manage virtualenv
RUN pip install pipenv==2024.4.0

RUN python -m venv /.venv
RUN --mount=type=cache,target=/root/.cache/pip pip install pipenv==2024.4.0

COPY Pipfile Pipfile.lock $APP_HOME/
RUN --mount=type=cache,target=/root/.cache/pip pipenv install --system --categories "packages dev-packages docs"

Expand Down
6 changes: 3 additions & 3 deletions scripts/start-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ python manage.py collectstatic --noinput
python manage.py compilemessages -v 0

echo "starting server..."
if [[ "${DJANGO_DEBUG,,}" == "true" ]]; then
if [[ "${ATTACH_DEBUGGER}" == "true" ]]; then
echo "waiting for debugger..."
python -m debugpy --wait-for-client --listen 0.0.0.0:9876 manage.py runserver_plus 0.0.0.0:9000
python -m debugpy --wait-for-client --listen 0.0.0.0:9876 manage.py runserver_plus 0.0.0.0:9000 --print-sql
else
python manage.py runserver 0.0.0.0:9000
python manage.py runserver_plus 0.0.0.0:9000 --print-sql
fi

0 comments on commit 88de800

Please sign in to comment.