-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from stuartmaxwell:maintenance
Maintenance
- Loading branch information
Showing
12 changed files
with
578 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Docker | ||
.dockerignore | ||
docker-compose* | ||
Dockerfile* | ||
|
||
# Git | ||
.git/ | ||
.github/ | ||
.gitignore | ||
|
||
# Virtual Environment | ||
.venv/ | ||
|
||
# IDEs and editors | ||
.idea | ||
.vscode | ||
.editorconfig | ||
|
||
# Tool configuration | ||
.mypy_cache/ | ||
.pytest_cache/ | ||
.ruff_cache/ | ||
.pre-commit-config.yaml | ||
.prettierignore | ||
# pyproject.toml | ||
pytest.ini | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Caddy config | ||
Caddyfile* | ||
|
||
# Project files not required | ||
docs/ | ||
staticfiles/ | ||
env.template | ||
requirements.in | ||
README.md | ||
media/ | ||
.env | ||
|
||
# Macos yuck | ||
.DS_Store | ||
|
||
# Other files that sometimes creep in | ||
**/*.sqlite3 | ||
**/*.csv | ||
**/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
services: | ||
app: | ||
build: . | ||
entrypoint: /app/entrypoint.sh | ||
command: uv run --no-cache manage.py runserver 0.0.0.0:8000 | ||
user: "1000" | ||
ports: | ||
- "8000:8000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3.8" | ||
|
||
services: | ||
app: | ||
image: ghcr.io/stuartmaxwell/stuartm.nz:latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
if [ "$DB" = "postgresql" ] | ||
# Exit immediately if any command fails | ||
set -e | ||
|
||
if [ "$DB_ENGINE" = "django.db.backends.postgresql" ] | ||
then | ||
echo "Waiting for postgresql..." | ||
|
||
while ! nc -z $DB_HOST $DB_PORT; do | ||
sleep 0.1 | ||
done | ||
|
||
echo "PostgreSQL started" | ||
echo "PostgreSQL ready!" | ||
fi | ||
|
||
python manage.py migrate --no-input | ||
python manage.py collectstatic --no-input | ||
# Apply database migrations | ||
echo "Applying database migrations" | ||
uv run --no-cache manage.py migrate --noinput | ||
|
||
# Collect static files | ||
echo "Collecting static files" | ||
uv run --no-cache manage.py collectstatic --noinput | ||
|
||
# Start the Django server with Gunicorn | ||
echo "Starting server" | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Set the default recipe to list all available commands | ||
default: | ||
@just --list | ||
|
||
# Set the Python version | ||
python_version := "3.12" | ||
|
||
# Set the uv run command | ||
uv := "uv run --python 3.12 --extra test" | ||
|
||
#Set the uv command to run a tool | ||
uv-tool := "uv tool run" | ||
|
||
# Run the Django development server | ||
run: | ||
@just sync | ||
{{uv}} manage.py runserver | ||
|
||
# Make migrations | ||
makemigrations: | ||
{{uv}} manage.py makemigrations | ||
|
||
# Apply migrations | ||
migrate: | ||
{{uv}} manage.py migrate | ||
|
||
# Create a superuser | ||
createsuperuser: | ||
{{uv}} manage.py createsuperuser | ||
|
||
# Collect static files | ||
collectstatic: | ||
{{uv}} manage.py collectstatic | ||
|
||
# Run Django shell | ||
shell: | ||
{{uv}} manage.py shell | ||
|
||
# Check for any problems in your project | ||
check: | ||
{{uv}} manage.py check | ||
|
||
# Run pytest | ||
test: | ||
{{uv}} pytest | ||
|
||
# Run Ruff linking | ||
lint: | ||
{{uv-tool}} ruff check | ||
|
||
# Run Ruff formatting | ||
format: | ||
{{uv-tool}} ruff format | ||
|
||
# Sync the package | ||
sync: | ||
uv sync --python {{python_version}} --all-extras | ||
|
||
# Sync and upgrade the package | ||
sync-up: | ||
uv sync --python {{python_version}} --all-extras --upgrade | ||
|
||
# Lock the package version | ||
lock: | ||
uv lock | ||
|
||
# Upgrade pre-commit hooks | ||
pc-up: | ||
{{uv-tool}} pre-commit autoupdate | ||
|
||
# Run pre-commit hooks | ||
pc-run: | ||
{{uv-tool}} pre-commit run --all-files | ||
|
||
# Run Docker compose up on the development environment | ||
dc-up-dev: | ||
docker-compose --file docker-compose-dev.yml up -d --build | ||
|
||
# Run Docker compose logs on the development environment | ||
dc-logs-dev: | ||
docker-compose --file docker-compose-dev.yml logs -f | ||
|
||
# Run a terminal on the development environment | ||
dc-exec-dev: | ||
docker compose --file docker-compose-dev.yml exec app /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.