Another go at sorting the settings mess
This commit is contained in:
parent
ab7d32d46e
commit
c1f0e48f80
@ -19,5 +19,6 @@ RUN SECRET_KEY=_ poly-tool collectstatic --noinput
|
|||||||
|
|
||||||
VOLUME ["/var/polyphonic"]
|
VOLUME ["/var/polyphonic"]
|
||||||
|
|
||||||
ENTRYPOINT ["poly-tool"]
|
RUN pip3 install gunicorn whitenoise
|
||||||
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
|
poetry run ruff format --check app || true
|
||||||
|
|
||||||
build:
|
build:
|
||||||
poetry build
|
poetry build
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
#!/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')
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "polyphonic.settings.base")
|
||||||
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:
|
||||||
@ -18,5 +19,5 @@ def main():
|
|||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
0
app/polyphonic/settings/__init__.py
Normal file
0
app/polyphonic/settings/__init__.py
Normal file
@ -15,7 +15,7 @@ import os
|
|||||||
|
|
||||||
|
|
||||||
# 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
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
||||||
|
|
||||||
# A place to put things
|
# A place to put things
|
||||||
WORK_DIR = os.environ.get("WORK_DIR") or os.path.join(BASE_DIR, "data")
|
WORK_DIR = os.environ.get("WORK_DIR") or os.path.join(BASE_DIR, "data")
|
||||||
@ -139,3 +139,4 @@ STATIC_ROOT = "static"
|
|||||||
CACHED_STORAGE_REMOTE = "byostorage.user.BYOStorage"
|
CACHED_STORAGE_REMOTE = "byostorage.user.BYOStorage"
|
||||||
CACHED_STORAGE_DIR = os.path.join(WORK_DIR, "cache")
|
CACHED_STORAGE_DIR = os.path.join(WORK_DIR, "cache")
|
||||||
WHOOSH_INDEX = os.path.join(WORK_DIR, "index")
|
WHOOSH_INDEX = os.path.join(WORK_DIR, "index")
|
||||||
|
STORAGE_CLASSES = ["library.gdrive.storage.GDriveLinkStorage"]
|
||||||
10
app/polyphonic/settings/dev.py
Normal file
10
app/polyphonic/settings/dev.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
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"]
|
||||||
4
app/polyphonic/settings/docker.py
Normal file
4
app/polyphonic/settings/docker.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from .base import * # noqa
|
||||||
|
|
||||||
|
# Enable WhiteNoise for static files
|
||||||
|
MIDDLEWARE.insert(1, "whitenoise.middleware.WhiteNoiseMiddleware") # noqa
|
||||||
@ -6,4 +6,6 @@ services:
|
|||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
volumes:
|
volumes:
|
||||||
- "./data:/var/polyphonic"
|
- "./data:/var/polyphonic"
|
||||||
env_file: "local.env"
|
env_file: "compose.env"
|
||||||
|
environment:
|
||||||
|
DJANGO_SETTINGS_MODULE: polyphonic.settings.docker
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
from .default_settings import *
|
|
||||||
import os
|
|
||||||
|
|
||||||
DEBUG = bool(os.environ.get("DEBUG", False))
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
"default": {
|
|
||||||
"ENGINE": "django.db.backends.sqlite3",
|
|
||||||
"NAME": "/var/polyphonic/db.sqlite3",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user