Rename project, part 2 #42

Merged
lukas merged 5 commits from rename-project-second-phase into main 2023-01-20 13:37:47 +00:00
13 changed files with 30 additions and 30 deletions
Showing only changes of commit 7d6b53cd1d - Show all commits

View File

@ -2,49 +2,49 @@ all: css migrate
initialize: npm css migrate sethookdir loadplatforms initialize: npm css migrate sethookdir loadplatforms
HTMLFILES := $(shell find timetracker/games/templates -type f) HTMLFILES := $(shell find games/templates -type f)
npm: npm:
npm install npm install
css: input.css css: input.css
npx tailwindcss -i ./input.css -o ./timetracker/games/static/base.css npx tailwindcss -i ./input.css -o ./games/static/base.css
css-dev: css css-dev: css
npx tailwindcss -i ./input.css -o ./timetracker/games/static/base.css --watch npx tailwindcss -i ./input.css -o ./games/static/base.css --watch
makemigrations: makemigrations:
poetry run python timetracker/manage.py makemigrations poetry run python manage.py makemigrations
migrate: makemigrations migrate: makemigrations
poetry run python timetracker/manage.py migrate poetry run python manage.py migrate
dev: migrate dev: migrate
poetry run python timetracker/manage.py runserver poetry run python manage.py runserver
caddy: caddy:
caddy run --watch caddy run --watch
dev-prod: migrate collectstatic dev-prod: migrate collectstatic
cd timetracker/; PROD=1 poetry run python -m gunicorn --bind 0.0.0.0:8001 root.asgi:application -k uvicorn.workers.UvicornWorker PROD=1 poetry run python -m gunicorn --bind 0.0.0.0:8001 timetracker.asgi:application -k uvicorn.workers.UvicornWorker
dumpgames: dumpgames:
poetry run python timetracker/manage.py dumpdata --format yaml games --output tracker_fixture.yaml poetry run python manage.py dumpdata --format yaml games --output tracker_fixture.yaml
loadplatforms: loadplatforms:
poetry run python timetracker/manage.py loaddata platforms.yaml poetry run python manage.py loaddata platforms.yaml
loadsample: loadsample:
poetry run python timetracker/manage.py loaddata sample.yaml poetry run python manage.py loaddata sample.yaml
createsuperuser: createsuperuser:
poetry run python timetracker/manage.py createsuperuser poetry run python manage.py createsuperuser
shell: shell:
poetry run python timetracker/manage.py shell poetry run python manage.py shell
collectstatic: collectstatic:
poetry run python timetracker/manage.py collectstatic --clear --no-input poetry run python manage.py collectstatic --clear --no-input
poetry.lock: pyproject.toml poetry.lock: pyproject.toml
poetry install poetry install
@ -56,6 +56,6 @@ date:
poetry run python -c 'import datetime; from zoneinfo import ZoneInfo; print(datetime.datetime.isoformat(datetime.datetime.now(ZoneInfo("Europe/Prague")), timespec="minutes", sep=" "))' poetry run python -c 'import datetime; from zoneinfo import ZoneInfo; print(datetime.datetime.isoformat(datetime.datetime.now(ZoneInfo("Europe/Prague")), timespec="minutes", sep=" "))'
cleanstatic: cleanstatic:
rm -r timetracker/static/* rm -r static/*
clean: cleanstatic clean: cleanstatic

View File

@ -1,7 +1,7 @@
import csv import csv
from typing import TypeAlias from typing import TypeAlias
from timetracker.games.models import Game from games.models import Game
DataList: TypeAlias = list[dict[str, str]] | None DataList: TypeAlias = list[dict[str, str]] | None

View File

@ -7,7 +7,7 @@ import matplotlib.dates as mdates
import pandas as pd import pandas as pd
from django.db.models import F, IntegerField, QuerySet, Sum from django.db.models import F, IntegerField, QuerySet, Sum
from django.db.models.functions import TruncDay from django.db.models.functions import TruncDay
from timetracker.games.models import Session from games.models import Session
def key_value_to_value_value(data): def key_value_to_value_value(data):

View File

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from timetracker.games.models import Game, Platform, Purchase, Session from games.models import Game, Platform, Purchase, Session
# Register your models here. # Register your models here.
admin.site.register(Game) admin.site.register(Game)

View File

@ -1,6 +1,6 @@
from django import forms from django import forms
from timetracker.games.models import Game, Platform, Purchase, Session from games.models import Game, Platform, Purchase, Session
class SessionForm(forms.ModelForm): class SessionForm(forms.ModelForm):

View File

@ -2,7 +2,7 @@ from datetime import datetime, timedelta
from typing import Any from typing import Any
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
from timetracker.common.time import format_duration from common.time import format_duration
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from django.db.models import F, Manager, Sum from django.db.models import F, Manager, Sum

View File

@ -1,6 +1,6 @@
from django.urls import path from django.urls import path
from timetracker.games import views from games import views
urlpatterns = [ urlpatterns = [
path("", views.index, name="index"), path("", views.index, name="index"),

View File

@ -1,8 +1,8 @@
from datetime import datetime from datetime import datetime
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
from timetracker.common.plots import playtime_over_time_chart from common.plots import playtime_over_time_chart
from timetracker.common.time import now as now_with_tz from common.time import now as now_with_tz
from django.conf import settings from django.conf import settings
from django.shortcuts import redirect, render from django.shortcuts import redirect, render

2
manage.py Normal file → Executable file
View File

@ -6,7 +6,7 @@ import sys
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.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:

View File

@ -1,7 +1,7 @@
import unittest import unittest
from datetime import timedelta from datetime import timedelta
from timetracker.common.time import format_duration from common.time import format_duration
class FormatDurationTest(unittest.TestCase): class FormatDurationTest(unittest.TestCase):

View File

@ -1,5 +1,5 @@
""" """
ASGI config for root project. ASGI config for timetracker project.
It exposes the ASGI callable as a module-level variable named ``application``. It exposes the ASGI callable as a module-level variable named ``application``.
@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings")
application = get_asgi_application() application = get_asgi_application()

View File

@ -32,7 +32,7 @@ ALLOWED_HOSTS = ["*"]
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
"timetracker.games.apps.GamesConfig", "games.apps.GamesConfig",
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes", "django.contrib.contenttypes",
"django.contrib.sessions", "django.contrib.sessions",
@ -54,7 +54,7 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
] ]
ROOT_URLCONF = "root.urls" ROOT_URLCONF = "timetracker.urls"
TEMPLATES = [ TEMPLATES = [
{ {
@ -73,7 +73,7 @@ TEMPLATES = [
}, },
] ]
WSGI_APPLICATION = "root.wsgi.application" WSGI_APPLICATION = "timetracker.wsgi.application"
# Database # Database

View File

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings")
application = get_wsgi_application() application = get_wsgi_application()