From 7d6b53cd1dbbe0b15099f65d5fb15e97ac281f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Thu, 19 Jan 2023 21:50:11 +0100 Subject: [PATCH] Update files --- Makefile | 28 ++++++++++++++-------------- common/import_data.py | 2 +- common/plots.py | 2 +- games/admin.py | 2 +- games/forms.py | 2 +- games/models.py | 2 +- games/urls.py | 2 +- games/views.py | 4 ++-- manage.py | 2 +- tests/test_time.py | 2 +- timetracker/asgi.py | 4 ++-- timetracker/settings.py | 6 +++--- timetracker/wsgi.py | 2 +- 13 files changed, 30 insertions(+), 30 deletions(-) mode change 100644 => 100755 manage.py diff --git a/Makefile b/Makefile index a73697c..bc0c38d 100644 --- a/Makefile +++ b/Makefile @@ -2,49 +2,49 @@ all: css migrate initialize: npm css migrate sethookdir loadplatforms -HTMLFILES := $(shell find timetracker/games/templates -type f) +HTMLFILES := $(shell find games/templates -type f) npm: npm install 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 - npx tailwindcss -i ./input.css -o ./timetracker/games/static/base.css --watch + npx tailwindcss -i ./input.css -o ./games/static/base.css --watch makemigrations: - poetry run python timetracker/manage.py makemigrations + poetry run python manage.py makemigrations migrate: makemigrations - poetry run python timetracker/manage.py migrate + poetry run python manage.py migrate dev: migrate - poetry run python timetracker/manage.py runserver + poetry run python manage.py runserver caddy: caddy run --watch 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: - 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: - poetry run python timetracker/manage.py loaddata platforms.yaml + poetry run python manage.py loaddata platforms.yaml loadsample: - poetry run python timetracker/manage.py loaddata sample.yaml + poetry run python manage.py loaddata sample.yaml createsuperuser: - poetry run python timetracker/manage.py createsuperuser + poetry run python manage.py createsuperuser shell: - poetry run python timetracker/manage.py shell + poetry run python manage.py shell 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 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=" "))' cleanstatic: - rm -r timetracker/static/* + rm -r static/* clean: cleanstatic diff --git a/common/import_data.py b/common/import_data.py index ad4b7e8..43a3463 100644 --- a/common/import_data.py +++ b/common/import_data.py @@ -1,7 +1,7 @@ import csv from typing import TypeAlias -from timetracker.games.models import Game +from games.models import Game DataList: TypeAlias = list[dict[str, str]] | None diff --git a/common/plots.py b/common/plots.py index 290c770..47e5f9c 100644 --- a/common/plots.py +++ b/common/plots.py @@ -7,7 +7,7 @@ import matplotlib.dates as mdates import pandas as pd from django.db.models import F, IntegerField, QuerySet, Sum 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): diff --git a/games/admin.py b/games/admin.py index d63b9d8..3c1b4d4 100644 --- a/games/admin.py +++ b/games/admin.py @@ -1,6 +1,6 @@ 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. admin.site.register(Game) diff --git a/games/forms.py b/games/forms.py index faf35b1..289aa20 100644 --- a/games/forms.py +++ b/games/forms.py @@ -1,6 +1,6 @@ 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): diff --git a/games/models.py b/games/models.py index 52fd6dc..2d6d916 100644 --- a/games/models.py +++ b/games/models.py @@ -2,7 +2,7 @@ from datetime import datetime, timedelta from typing import Any from zoneinfo import ZoneInfo -from timetracker.common.time import format_duration +from common.time import format_duration from django.conf import settings from django.db import models from django.db.models import F, Manager, Sum diff --git a/games/urls.py b/games/urls.py index e36129a..afa69a7 100644 --- a/games/urls.py +++ b/games/urls.py @@ -1,6 +1,6 @@ from django.urls import path -from timetracker.games import views +from games import views urlpatterns = [ path("", views.index, name="index"), diff --git a/games/views.py b/games/views.py index e457e70..3e42709 100644 --- a/games/views.py +++ b/games/views.py @@ -1,8 +1,8 @@ from datetime import datetime from zoneinfo import ZoneInfo -from timetracker.common.plots import playtime_over_time_chart -from timetracker.common.time import now as now_with_tz +from common.plots import playtime_over_time_chart +from common.time import now as now_with_tz from django.conf import settings from django.shortcuts import redirect, render diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 index a3660b8..7ce9324 --- a/manage.py +++ b/manage.py @@ -6,7 +6,7 @@ import sys def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/tests/test_time.py b/tests/test_time.py index c2bfd3e..907a800 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -1,7 +1,7 @@ import unittest from datetime import timedelta -from timetracker.common.time import format_duration +from common.time import format_duration class FormatDurationTest(unittest.TestCase): diff --git a/timetracker/asgi.py b/timetracker/asgi.py index 1ce85f3..d0b8985 100644 --- a/timetracker/asgi.py +++ b/timetracker/asgi.py @@ -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``. @@ -11,6 +11,6 @@ import os 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() diff --git a/timetracker/settings.py b/timetracker/settings.py index 178e04d..90254ed 100644 --- a/timetracker/settings.py +++ b/timetracker/settings.py @@ -32,7 +32,7 @@ ALLOWED_HOSTS = ["*"] # Application definition INSTALLED_APPS = [ - "timetracker.games.apps.GamesConfig", + "games.apps.GamesConfig", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", @@ -54,7 +54,7 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = "root.urls" +ROOT_URLCONF = "timetracker.urls" TEMPLATES = [ { @@ -73,7 +73,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = "root.wsgi.application" +WSGI_APPLICATION = "timetracker.wsgi.application" # Database diff --git a/timetracker/wsgi.py b/timetracker/wsgi.py index 0b519bb..b9dbc0b 100644 --- a/timetracker/wsgi.py +++ b/timetracker/wsgi.py @@ -11,6 +11,6 @@ import os 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()