diff --git a/test-django-cache-module/pyproject.toml b/test-django-cache-module/pyproject.toml new file mode 100644 index 0000000..8b4a4f0 --- /dev/null +++ b/test-django-cache-module/pyproject.toml @@ -0,0 +1,21 @@ +[project] +name = "test-django-cache-module" +version = "0" +requires-python = ">=3.12" + +dependencies = [ + "django>=5.2", + "gunicorn>=23.0.0", + "ipdb>=0.13.13", + "locust>=2.32.4", + "matplotlib>=3.10.1", + "memcache>=1.4.1", + "memory-profiler>=0.61.0", + "psycopg>=3.2.6", + "pymemcache>=4.0.0", + "redis>=5.2.1", + "sentry-sdk[django]", +] + +[tool.uv.sources] +sentry-sdk = { path = "../../sentry-python", editable = true } diff --git a/test-django-cache-module/requirements.txt b/test-django-cache-module/requirements.txt deleted file mode 100644 index 34cfb67..0000000 --- a/test-django-cache-module/requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -Django -gunicorn # application server -psycopg # connection to Postgres database - -memcache # caching -pymemcache # caching -redis # caching - -ipdb # debugging - -locust # load testing -memory_profiler # memory profiling -matplotlib # plotting the memory profile - --e ../../../code/sentry-python # sdk in a sibling folder to this projects folder diff --git a/test-django-cache-module/run-django.sh b/test-django-cache-module/run-django.sh index b82d20e..5792e88 100755 --- a/test-django-cache-module/run-django.sh +++ b/test-django-cache-module/run-django.sh @@ -1,26 +1,13 @@ #!/usr/bin/env bash +set -euo pipefail -# exit on first error -set -xe - -# create and activate virtual environment -python -m venv .venv -source .venv/bin/activate - -# Install (or update) requirements -python -m pip install -r requirements.txt +if ! command -v uv &> /dev/null; then + curl -LsSf https://astral.sh/uv/install.sh | sh +fi pkill redis-server || true sleep 1 rm -rf dump.rdb redis-server --daemonize yes -# run migrations -# cd mysite && ./manage.py migrate && cd .. - -# Run Django application on localhost:8000 (DEBUG) -# cd mysite && ./manage.py runserver 0.0.0.0:8000 && cd .. - -# Run Django application on localhost:8000 (PRODUCTION) -cd mysite && mprof run --multiprocess --output "../mprofile_$(date +%Y%m%d%H%M%S).dat" gunicorn wsgi && cd .. -# cd mysite && gunicorn --log-level 'debug' wsgi && cd .. +cd mysite && uv run mprof run --multiprocess --output "../mprofile_$(date +%Y%m%d%H%M%S).dat" gunicorn wsgi && cd .. diff --git a/test-django-cache-module/run-locust.sh b/test-django-cache-module/run-locust.sh index e0d5b14..312c922 100755 --- a/test-django-cache-module/run-locust.sh +++ b/test-django-cache-module/run-locust.sh @@ -1,10 +1,8 @@ #!/usr/bin/env bash +set -euo pipefail -# exit on first error -set -xe +if ! command -v uv &> /dev/null; then + curl -LsSf https://astral.sh/uv/install.sh | sh +fi -# create and activate virtual environment -python -m venv .venv -source .venv/bin/activate - -locust \ No newline at end of file +uv run locust