From d5e54c9df410e512ba0fd0219316e9a08347f9cc Mon Sep 17 00:00:00 2001 From: Ivan Filippov Date: Tue, 12 Dec 2023 00:35:17 +0500 Subject: [PATCH] Preparation for a command manager --- .gitignore | 2 ++ Makefile | 5 +++++ .../adaptive_hockey_federation/settings.py | 1 + adaptive_hockey_federation/core/apps.py | 5 +++++ .../core/management/commands/__init__.py | 0 .../core/management/commands/fill-db.py | 9 +++++++++ 6 files changed, 22 insertions(+) create mode 100644 adaptive_hockey_federation/core/apps.py create mode 100644 adaptive_hockey_federation/core/management/commands/__init__.py create mode 100644 adaptive_hockey_federation/core/management/commands/fill-db.py diff --git a/.gitignore b/.gitignore index f5f0d26e..e4171154 100644 --- a/.gitignore +++ b/.gitignore @@ -158,4 +158,6 @@ cython_debug/ # Static static/ +# Protected project files /adaptive_hockey_federation/parser/Именная заявка/ +resourses/ diff --git a/Makefile b/Makefile index ef9e6fc9..7a7cf967 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ help: @echo " migrate - $(SHELL_GREEN)Команда для применения к базе данных готовых миграций.$(SHELL_NC)" @echo " createsuperuser - $(SHELL_GREEN)Команда для создания супер-юзера.$(SHELL_NC)" @echo " run - $(SHELL_GREEN)Команда для локального запуска проекта.$(SHELL_NC)" + @echo " fill-db - $(SHELL_GREEN)Команда для заполнения базы данных с помощью парсера.$(SHELL_NC)" @echo " help - $(SHELL_GREEN)Команда вызова справки.$(SHELL_NC)" @echo "$(SHELL_YELLOW)Для запуска исполнения команд используйте данные ключи совместно с командой 'make', например 'make init-app'." @echo "При запуске команды 'make' без какого либо ключа, происходит вызов справки.$(SHELL_NC)" @@ -56,4 +57,8 @@ run: cd $(PROJECT_DIR) && $(DJANGO_RUN) runserver +# Заполнение базы данных с помощью парсера. +fill-db: + cd $(PROJECT_DIR) && $(DJANGO_RUN) fill-db + .PHONY: help diff --git a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py b/adaptive_hockey_federation/adaptive_hockey_federation/settings.py index 4f0e2000..c79871cf 100644 --- a/adaptive_hockey_federation/adaptive_hockey_federation/settings.py +++ b/adaptive_hockey_federation/adaptive_hockey_federation/settings.py @@ -18,6 +18,7 @@ 'django.contrib.staticfiles', 'main.apps.MainConfig', 'users.apps.UsersConfig', + 'core.apps.CoreConfig', ] MIDDLEWARE = [ diff --git a/adaptive_hockey_federation/core/apps.py b/adaptive_hockey_federation/core/apps.py new file mode 100644 index 00000000..26f78a8e --- /dev/null +++ b/adaptive_hockey_federation/core/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CoreConfig(AppConfig): + name = 'core' diff --git a/adaptive_hockey_federation/core/management/commands/__init__.py b/adaptive_hockey_federation/core/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/adaptive_hockey_federation/core/management/commands/fill-db.py b/adaptive_hockey_federation/core/management/commands/fill-db.py new file mode 100644 index 00000000..12bf3418 --- /dev/null +++ b/adaptive_hockey_federation/core/management/commands/fill-db.py @@ -0,0 +1,9 @@ + +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = "Описание команды" + + def handle(self, *args, **options): + return 'Я заготовка'