Compare commits

...

5 Commits

6 changed files with 16 additions and 9 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
src/web/static/*

View File

@ -6,10 +6,11 @@ RUN npm install && \
FROM python:3.10.9-alpine FROM python:3.10.9-alpine
ENV VERSION_NUMBER 0.1.1-3-gd029fda ENV VERSION_NUMBER 0.1.1-8-gf7b69f7
ENV PROD 1 ENV PROD 1
RUN apk add \ RUN apk add \
bash \
vim \ vim \
curl \ curl \
caddy caddy

View File

@ -1,5 +1,3 @@
.PHONY: createsuperuser shell cleanstatic
all: css migrate all: css migrate
initialize: npm css migrate sethookdir loadplatforms initialize: npm css migrate sethookdir loadplatforms
@ -24,8 +22,11 @@ migrate: makemigrations
dev: migrate sethookdir dev: migrate sethookdir
poetry run python src/web/manage.py runserver_plus poetry run python src/web/manage.py runserver_plus
caddy:
caddy run --watch
dev-prod: migrate collectstatic sethookdir dev-prod: migrate collectstatic sethookdir
cd src/web/; poetry run python -m gunicorn --bind 0.0.0.0:8001 web.asgi:application -k uvicorn.workers.UvicornWorker cd src/web/; PROD=1 poetry run python -m gunicorn --bind 0.0.0.0:8001 web.asgi:application -k uvicorn.workers.UvicornWorker
dumptracker: dumptracker:
poetry run python src/web/manage.py dumpdata --format yaml tracker --output tracker_fixture.yaml poetry run python src/web/manage.py dumpdata --format yaml tracker --output tracker_fixture.yaml

View File

@ -1,9 +1,10 @@
--- ---
version: "2.1"
services: services:
timetracker: timetracker:
image: registry.kucharczyk.xyz/timetracker image: registry.kucharczyk.xyz/timetracker
build: Dockerfile build:
context: .
dockerfile: Dockerfile
container_name: timetracker container_name: timetracker
environment: environment:
- TZ=Europe/Prague - TZ=Europe/Prague

View File

@ -8,6 +8,6 @@ echo "Collect static files"
poetry run python src/web/manage.py collectstatic poetry run python src/web/manage.py collectstatic
echo "Starting server" echo "Starting server"
caddy run caddy start
cd src/web || exit cd src/web || exit
poetry run python -m gunicorn --bind 0.0.0.0:8001 web.asgi:application -k uvicorn.workers.UvicornWorker poetry run python -m gunicorn --bind 0.0.0.0:8001 web.asgi:application -k uvicorn.workers.UvicornWorker

View File

@ -16,10 +16,13 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.views.generic import RedirectView from django.views.generic import RedirectView
from django.conf import settings
urlpatterns = [ urlpatterns = [
path("admin/", admin.site.urls),
path("", RedirectView.as_view(url="/tracker/list-sessions")), path("", RedirectView.as_view(url="/tracker/list-sessions")),
path("tracker/", include("tracker.urls")), path("tracker/", include("tracker.urls")),
] ]
if settings.DEBUG:
urlpatterns.append(path("admin/", admin.site.urls))