Compare commits
No commits in common. "c1f0e48f8000b6309c994d7d05b2d0d98ce2161d" and "93c4926dfde4fc4f6716d26709cbdfe7800d1b2e" have entirely different histories.
c1f0e48f80
...
93c4926dfd
@ -15,10 +15,10 @@ RUN pip3 install ${RELEASE} --no-cache-dir
|
|||||||
|
|
||||||
WORKDIR ${TARGET}
|
WORKDIR ${TARGET}
|
||||||
|
|
||||||
RUN SECRET_KEY=_ poly-tool collectstatic --noinput
|
COPY docker_settings.py local_settings.py
|
||||||
|
RUN SECRET_KEY=_ ${TARGET}/bin/manage collectstatic --noinput
|
||||||
|
|
||||||
VOLUME ["/var/polyphonic"]
|
VOLUME ["/var/polyphonic"]
|
||||||
|
|
||||||
RUN pip3 install gunicorn whitenoise
|
ENTRYPOINT ["manage"]
|
||||||
|
CMD ["runserver", "0.0.0.0:8000", "--insecure"]
|
||||||
CMD ["gunicorn", "-b", "0.0.0.0", "polyphonic.wsgi"]
|
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ test: check
|
|||||||
|
|
||||||
check:
|
check:
|
||||||
poetry run ruff check app
|
poetry run ruff check app
|
||||||
poetry run ruff format --check app || true
|
poetry run ruff format --check app
|
||||||
|
|
||||||
build:
|
build:
|
||||||
poetry build
|
poetry build
|
||||||
|
|||||||
@ -3,7 +3,7 @@ from whoosh.analysis import StemmingAnalyzer, CharsetFilter
|
|||||||
from whoosh.support.charset import accent_map
|
from whoosh.support.charset import accent_map
|
||||||
from whoosh.fields import Schema, TEXT, KEYWORD, NUMERIC
|
from whoosh.fields import Schema, TEXT, KEYWORD, NUMERIC
|
||||||
from whoosh.qparser import QueryParser
|
from whoosh.qparser import QueryParser
|
||||||
from whoosh.query import Term, NullQuery, Prefix
|
from whoosh.query import Term, NullQuery, Prefix, FuzzyTerm
|
||||||
|
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -24,7 +24,7 @@ schema = Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
index_path = settings.WHOOSH_INDEX
|
index_path = os.path.join(os.path.dirname(settings.BASE_DIR), "index")
|
||||||
|
|
||||||
|
|
||||||
def create_index() -> Index:
|
def create_index() -> Index:
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Django's command-line utility for administrative tasks."""
|
"""Django's command-line utility for administrative tasks."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "polyphonic.settings.base")
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'polyphonic.settings')
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
@ -19,5 +18,5 @@ def main():
|
|||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -11,25 +11,22 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
from os import environ
|
||||||
|
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
# A place to put things
|
SECRET_KEY = environ.get("SECRET_KEY")
|
||||||
WORK_DIR = os.environ.get("WORK_DIR") or os.path.join(BASE_DIR, "data")
|
|
||||||
|
|
||||||
# Will fail to start if not defined
|
|
||||||
SECRET_KEY = os.environ.get("SECRET_KEY")
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ["localhost"]
|
ALLOWED_HOSTS = ["localhost"]
|
||||||
|
INTERNAL_IPS = ["127.0.0.1"]
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
@ -50,8 +47,6 @@ INSTALLED_APPS = [
|
|||||||
"interface",
|
"interface",
|
||||||
]
|
]
|
||||||
|
|
||||||
INSTALLED_APPS += POLYPHONIC_MODULES
|
|
||||||
|
|
||||||
CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",)
|
CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",)
|
||||||
CRISPY_TEMPLATE_PACK = "bulma"
|
CRISPY_TEMPLATE_PACK = "bulma"
|
||||||
|
|
||||||
@ -92,7 +87,7 @@ WSGI_APPLICATION = "polyphonic.wsgi.application"
|
|||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.sqlite3",
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
"NAME": os.path.join(WORK_DIR, "db.sqlite3"),
|
"NAME": BASE_DIR / "db.sqlite3",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,18 +120,17 @@ LANGUAGE_CODE = "en-us"
|
|||||||
TIME_ZONE = "Australia/Melbourne"
|
TIME_ZONE = "Australia/Melbourne"
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
USE_L10N = True
|
USE_L10N = True
|
||||||
|
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = "/static/"
|
STATIC_URL = "/static/"
|
||||||
STATIC_ROOT = "static"
|
STATIC_ROOT = "static"
|
||||||
|
|
||||||
# Library settings
|
# Need to set this
|
||||||
|
AWS_BUCKET = ""
|
||||||
CACHED_STORAGE_REMOTE = "byostorage.user.BYOStorage"
|
|
||||||
CACHED_STORAGE_DIR = os.path.join(WORK_DIR, "cache")
|
|
||||||
WHOOSH_INDEX = os.path.join(WORK_DIR, "index")
|
|
||||||
STORAGE_CLASSES = ["library.gdrive.storage.GDriveLinkStorage"]
|
|
||||||
11
app/polyphonic/settings.py
Normal file
11
app/polyphonic/settings.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.getcwd())
|
||||||
|
|
||||||
|
try:
|
||||||
|
from local_settings import * # noqa
|
||||||
|
except ImportError:
|
||||||
|
from .default_settings import * # noqa
|
||||||
|
|
||||||
|
INSTALLED_APPS += POLYPHONIC_MODULES # type: ignore #noqa
|
||||||
@ -1,10 +0,0 @@
|
|||||||
from .base import * # noqa
|
|
||||||
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
SECRET_KEY = "DO NOT USE IN PRODUCTION"
|
|
||||||
|
|
||||||
# Enable debug toolbar
|
|
||||||
INSTALLED_APPS.append("debug_toolbar") # noqa
|
|
||||||
MIDDLEWARE.insert(1, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa
|
|
||||||
INTERNAL_IPS = ["127.0.0.1"]
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
from .base import * # noqa
|
|
||||||
|
|
||||||
# Enable WhiteNoise for static files
|
|
||||||
MIDDLEWARE.insert(1, "whitenoise.middleware.WhiteNoiseMiddleware") # noqa
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
services:
|
|
||||||
polyphonic:
|
|
||||||
image: "polyphonic:latest"
|
|
||||||
build: "."
|
|
||||||
ports:
|
|
||||||
- "8000:8000"
|
|
||||||
volumes:
|
|
||||||
- "./data:/var/polyphonic"
|
|
||||||
env_file: "compose.env"
|
|
||||||
environment:
|
|
||||||
DJANGO_SETTINGS_MODULE: polyphonic.settings.docker
|
|
||||||
13
docker_settings.py
Normal file
13
docker_settings.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from polyphonic.default_settings import *
|
||||||
|
import os
|
||||||
|
|
||||||
|
DEBUG = bool(os.environ.get("DEBUG", False))
|
||||||
|
|
||||||
|
CACHE_DIR = "/var/polyphonic/cache"
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
"default": {
|
||||||
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
|
"NAME": "/var/polyphonic/db.sqlite3",
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,25 +2,27 @@
|
|||||||
name = "polyphonic"
|
name = "polyphonic"
|
||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
description = "Polyphonic Ensemble Manager"
|
description = "Polyphonic Ensemble Manager"
|
||||||
authors = [{ name = "Tris Forster", email = "tris@tfconsulting.com.au" }]
|
authors = [
|
||||||
|
{name = "Tris Forster",email = "tris@tfconsulting.com.au"}
|
||||||
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"django (==6.0.4)",
|
"django (==6.0.4)",
|
||||||
"django-crispy-forms",
|
"django-crispy-forms",
|
||||||
"django-markdown2",
|
"django-markdown2",
|
||||||
"django-rest-framework",
|
"django-rest-framework",
|
||||||
"crispy-bulma (>=0.12.0,<0.13.0)",
|
"crispy-bulma (>=0.12.0,<0.13.0)",
|
||||||
"django-byostorage @ git+https://gitea.tfconsulting.com.au/tris/django-byostorage.git@9903bb00888f20dfd2d39754e5ee22eeb5f36298",
|
"django-byostorage @ git+https://gitea.tfconsulting.com.au/tris/django-byostorage.git@9903bb00888f20dfd2d39754e5ee22eeb5f36298",
|
||||||
"requests (>=2.32.5,<3.0.0)",
|
"requests (>=2.32.5,<3.0.0)",
|
||||||
"django-storages (>=1.14.6,<2.0.0)",
|
"django-storages (>=1.14.6,<2.0.0)",
|
||||||
"boto3 (>=1.40.20,<2.0.0)",
|
"boto3 (>=1.40.20,<2.0.0)",
|
||||||
"whoosh (>=2.7.4,<3.0.0)",
|
"whoosh (>=2.7.4,<3.0.0)",
|
||||||
"tzdata (>=2026.2,<2027.0)",
|
"tzdata (>=2026.2,<2027.0)"
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
packages = [{ include = "*", from = "app" }]
|
packages = [{include = "*", from="app"}]
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
django-debug-toolbar = "5.2"
|
django-debug-toolbar = "5.2"
|
||||||
@ -28,7 +30,7 @@ ruff = "^0.15.12"
|
|||||||
coverage = "^7.14.0"
|
coverage = "^7.14.0"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
poly-tool = "manage:main"
|
manage = "manage:main"
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
extend-exclude = ["**/migrations/"]
|
extend-exclude = ["**/migrations/"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user