From 6d9a6d414acf4c46f823c63a5cdaad873fd2ca1a Mon Sep 17 00:00:00 2001 From: Kevin Rue-Albrecht Date: Thu, 30 Apr 2026 11:14:22 +0100 Subject: [PATCH 1/3] move mysqlclient out of core and into new prod requirements --- dev-requirements.txt | 4 +-- doc-requirements.txt | 4 +-- prod-requirements.txt | 69 +++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 4 ++- requirements.txt | 4 +-- 5 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 prod-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt index 080ec9bf..7b2534ed 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.13 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --extra=dev --output-file=dev-requirements.txt @@ -102,8 +102,6 @@ mypy==1.20.0 # django-stubs mypy-extensions==1.1.0 # via mypy -mysqlclient==2.2.8 - # via direct_webapp (pyproject.toml) nh3==0.3.4 # via direct_webapp (pyproject.toml) nodeenv==1.10.0 diff --git a/doc-requirements.txt b/doc-requirements.txt index 630147ab..e2fa5e0c 100644 --- a/doc-requirements.txt +++ b/doc-requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.13 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --extra=doc --output-file=doc-requirements.txt @@ -120,8 +120,6 @@ mkdocstrings==1.0.3 # mkdocstrings-python mkdocstrings-python==2.0.3 # via direct_webapp (pyproject.toml) -mysqlclient==2.2.8 - # via direct_webapp (pyproject.toml) nh3==0.3.4 # via direct_webapp (pyproject.toml) packaging==26.0 diff --git a/prod-requirements.txt b/prod-requirements.txt new file mode 100644 index 00000000..e0055a91 --- /dev/null +++ b/prod-requirements.txt @@ -0,0 +1,69 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile --extra=prod --output-file=prod-requirements.txt +# +asgiref==3.11.1 + # via django +certifi==2026.4.22 + # via requests +charset-normalizer==3.4.7 + # via requests +confusable-homoglyphs==3.3.1 + # via django-registration +crispy-bootstrap5==2026.3 + # via direct_webapp (pyproject.toml) +diff-match-patch==20241021 + # via django-import-export +django==6.0.3 + # via + # crispy-bootstrap5 + # direct_webapp (pyproject.toml) + # django-bootstrap5 + # django-crispy-forms + # django-import-export + # django-multiselectfield + # django-registration + # django-stubs-ext + # django-tables2 +django-bootstrap5==26.2 + # via direct_webapp (pyproject.toml) +django-crispy-forms==2.6 + # via + # crispy-bootstrap5 + # direct_webapp (pyproject.toml) +django-import-export==4.4.0 + # via direct_webapp (pyproject.toml) +django-multiselectfield==1.0.1 + # via direct_webapp (pyproject.toml) +django-registration==5.2.1 + # via direct_webapp (pyproject.toml) +django-stubs-ext==6.0.2 + # via direct_webapp (pyproject.toml) +django-tables2==3.0.0 + # via direct_webapp (pyproject.toml) +gunicorn==25.3.0 + # via direct_webapp (pyproject.toml) +idna==3.13 + # via requests +markdown==3.10.2 + # via direct_webapp (pyproject.toml) +mysqlclient==2.2.8 + # via direct_webapp (pyproject.toml) +nh3==0.3.4 + # via direct_webapp (pyproject.toml) +packaging==26.0 + # via gunicorn +requests==2.33.1 + # via direct_webapp (pyproject.toml) +sqlparse==0.5.5 + # via django +tablib==3.9.0 + # via django-import-export +typing-extensions==4.15.0 + # via django-stubs-ext +urllib3==2.6.3 + # via requests +whitenoise==6.12.0 + # via direct_webapp (pyproject.toml) diff --git a/pyproject.toml b/pyproject.toml index 17f76c63..27795725 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ dependencies = [ "crispy-bootstrap5", "gunicorn", "whitenoise", - "mysqlclient", "django-import-export", "django-multiselectfield", "django-tables2", @@ -41,6 +40,9 @@ dev = [ "types-requests", "beautifulsoup4", ] +prod = [ + "mysqlclient", +] doc = [ "mkdocs<2", "mkdocstrings", diff --git a/requirements.txt b/requirements.txt index 39dfe18a..4b553555 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.13 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile @@ -49,8 +49,6 @@ idna==3.13 # via requests markdown==3.10.2 # via direct_webapp (pyproject.toml) -mysqlclient==2.2.8 - # via direct_webapp (pyproject.toml) nh3==0.3.4 # via direct_webapp (pyproject.toml) packaging==26.0 From bda77a960a00e68cdc9a6b5dc9e4b27fc1a1855c Mon Sep 17 00:00:00 2001 From: Kevin Rue-Albrecht Date: Thu, 30 Apr 2026 11:15:33 +0100 Subject: [PATCH 2/3] edit Dockerfile to use prod requirements --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 155e1366..256aa461 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --no-cache-dir -r prod-requirements.txt COPY --chown=nobody:nogroup . . From 677edcba167c177c843c0204eaf66af8d9a146b3 Mon Sep 17 00:00:00 2001 From: Kevin Rue-Albrecht Date: Thu, 30 Apr 2026 11:54:14 +0100 Subject: [PATCH 3/3] document error message faced when running server the first time --- README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7f6e6a1a..dd49e80d 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,19 @@ To get started: pre-commit install ``` -5. Run the webapp: +5. First-time database setup: + + Before running the server for the first time, initialise the database tables as follows: + + ```bash + python manage.py migrate + ``` + + If you run into the following error, then you've missed this step: + + `django.db.utils.OperationalError: no such table: main_skilllevel` + +6. Run the webapp: ```bash python manage.py runserver @@ -81,19 +93,19 @@ To get started: then restart it. -6. Run the tests: +7. Run the tests: ```bash pytest ``` -7. Create an admin account to access admin backend: +8. Create an admin account to access admin backend: ```bash python manage.py createsuperuser ``` -8. To populate the db with Categories and Skills from a yaml or json version of the framework +9. To populate the db with Categories and Skills from a yaml or json version of the framework ```bash python -m scripts.populate_db [-j data.json]|[-y data.yaml]