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 . . diff --git a/README.md b/README.md index 8055640b..3bea590e 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,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 @@ -83,19 +95,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. Populate the database using a snapshot of v2.0 of the framework (this is not necessarily the latest live version, so this is only used for development). +9. Populate the database using a snapshot of v2.0 of the framework (this is not necessarily the latest live version, so this is only used for development). ```bash python manage.py loaddata direct_webapp/fixtures/framework-2-0.json 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