Skip to content

Commit

Permalink
fixes Dockerfile and settings
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Jun 21, 2024
1 parent abe4ad6 commit 00588f8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docker/bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
export MEDIA_ROOT="${MEDIA_ROOT:-/var/run/app/media}"
export STATIC_ROOT="${STATIC_ROOT:-/var/run/app/static}"
export UWSGI_PROCESSES="${UWSGI_PROCESSES:-"4"}"
export DJANGO_SETTINGS_MODULE="${DJANGO_SETTINGS_MODULE:-"hope_dedup_engine.config.settings"}"
mkdir -p "${MEDIA_ROOT}" "${STATIC_ROOT}" || echo "Cannot create dirs ${MEDIA_ROOT} ${STATIC_ROOT}"

case "$1" in
run)
django-admin check --deploy
django-admin upgrade
set -- tini -- "$@"
set -- gosu user:app uwsgi --ini /conf/uwsgi.ini
;;
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ http=0.0.0.0:8000
enable-threads=0
honour-range=1
master=1
module=trash.wsgi
module=hope_dedup_engine.config.wsgi
processes=$(UWSGI_PROCESSES)
;virtualenv=/code/.venv/
;virtualenv=%(_)
Expand Down
1 change: 1 addition & 0 deletions src/hope_dedup_engine/apps/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ class Config(AppConfig):
def ready(self) -> None:
super().ready()
from hope_dedup_engine.utils import flags # noqa
from . import checks # noqa
19 changes: 19 additions & 0 deletions src/hope_dedup_engine/apps/core/checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.core.checks import Error, register
from django.conf import settings
from pathlib import Path

@register()
def example_check(app_configs, **kwargs):
errors = []
for t in settings.TEMPLATES:
for d in t["DIRS"]:
if not Path(d).is_dir():
errors.append(
Error(
f"'{d}' is not a directory",
hint="Remove this directory from settings.TEMPLATES.",
obj=settings,
id="hde.E001",
)
)
return errors
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def handle(self, *args: Any, **options: Any) -> None: # noqa: C901
"stdout": self.stdout,
}
echo("Running upgrade", style_func=self.style.WARNING)

call_command("env", check=True)

if self.run_check:
Expand Down
3 changes: 1 addition & 2 deletions src/hope_dedup_engine/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
SETTINGS_DIR = Path(__file__).parent
PACKAGE_DIR = SETTINGS_DIR.parent
DEVELOPMENT_DIR = PACKAGE_DIR.parent.parent

DEBUG = env.bool("DEBUG")

Expand Down Expand Up @@ -129,7 +128,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [str(PACKAGE_DIR / "templates")],
"DIRS": [str(PACKAGE_DIR / "web/templates")],
"APP_DIRS": False,
"OPTIONS": {
"loaders": [
Expand Down

0 comments on commit 00588f8

Please sign in to comment.