From e9311225e79311ee3eed2e1cc792563276178adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 26 Jun 2024 17:14:36 +0200 Subject: [PATCH] Make setting up and developing easier --- .gitignore | 1 + Makefile | 20 +++++++++++++++----- README.md | 14 +++++++++++++- package.json | 1 + 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index aef4ddf..983599a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ db.sqlite3 /static/ dist/ .DS_Store +.python-version diff --git a/Makefile b/Makefile index 8d45097..0ece711 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ all: css migrate initialize: npm css migrate sethookdir loadplatforms HTMLFILES := $(shell find games/templates -type f) +PYTHON_VERSION = 3.12 npm: npm install @@ -10,17 +11,26 @@ npm: css: common/input.css npx tailwindcss -i ./common/input.css -o ./games/static/base.css -css-dev: css - npx tailwindcss -i ./common/input.css -o ./games/static/base.css --watch - makemigrations: poetry run python manage.py makemigrations migrate: makemigrations poetry run python manage.py migrate -dev: migrate - poetry run python manage.py runserver +init: + pyenv install -s $(PYTHON_VERSION) + pyenv local $(PYTHON_VERSION) + pip install poetry + poetry install + npm install + +dev: + @npx concurrently \ + --names "Django,Tailwind" \ + --prefix-colors "blue,green" \ + "poetry run python manage.py runserver" \ + "npx tailwindcss -i ./common/input.css -o ./games/static/base.css --watch" + caddy: caddy run --watch diff --git a/README.md b/README.md index 84f4b74..2ef897c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # Timetracker -A simple game catalogue and play session tracker. \ No newline at end of file +A simple game catalogue and play session tracker. + +# Development + +The project uses `pyenv` to manage installed Python versions. +If you have `pyenv` installed, you can simply run: + +``` +make init +``` + +This will make sure the correct Python version is installed, and it will install all dependencies using `poetry`. +Afterwards, you can start the development server using `make dev`. \ No newline at end of file diff --git a/package.json b/package.json index 6f4d295..0bc43e4 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "devDependencies": { "@tailwindcss/forms": "^0.5.6", "@tailwindcss/typography": "^0.5.10", + "concurrently": "^8.2.2", "tailwindcss": "^3.3.3" } }