diff --git a/.gitignore b/.gitignore index 5966e2b1..eddc93a0 100644 --- a/.gitignore +++ b/.gitignore @@ -162,7 +162,4 @@ cython_debug/ */.* */*.tmp Database/* - - - - +/FRONTEND/git-version.txt diff --git a/FRONTEND/fastparking/accounts/migrations/0001_initial.py b/FRONTEND/fastparking/accounts/migrations/0001_initial.py new file mode 100644 index 00000000..b029fa3f --- /dev/null +++ b/FRONTEND/fastparking/accounts/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 5.0.4 on 2024-04-11 21:38 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('cars', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='MyCars', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('brand', models.CharField(max_length=100)), + ('car_type', models.CharField(max_length=100)), + ('car_number', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cars.car')), + ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/FRONTEND/fastparking/accounts/migrations/0002_remove_mycars_car_number.py b/FRONTEND/fastparking/accounts/migrations/0002_remove_mycars_car_number.py new file mode 100644 index 00000000..40331b25 --- /dev/null +++ b/FRONTEND/fastparking/accounts/migrations/0002_remove_mycars_car_number.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.4 on 2024-04-12 20:39 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='mycars', + name='car_number', + ), + ] diff --git a/FRONTEND/fastparking/accounts/migrations/0003_mycars_car_number.py b/FRONTEND/fastparking/accounts/migrations/0003_mycars_car_number.py new file mode 100644 index 00000000..a9aab0c3 --- /dev/null +++ b/FRONTEND/fastparking/accounts/migrations/0003_mycars_car_number.py @@ -0,0 +1,20 @@ +# Generated by Django 5.0.4 on 2024-04-13 12:15 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0002_remove_mycars_car_number'), + ('cars', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='mycars', + name='car_number', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cars.car'), + ), + ] diff --git a/FRONTEND/fastparking/accounts/migrations/0004_remove_mycars_car_number.py b/FRONTEND/fastparking/accounts/migrations/0004_remove_mycars_car_number.py new file mode 100644 index 00000000..999dded3 --- /dev/null +++ b/FRONTEND/fastparking/accounts/migrations/0004_remove_mycars_car_number.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.4 on 2024-04-13 13:54 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0003_mycars_car_number'), + ] + + operations = [ + migrations.RemoveField( + model_name='mycars', + name='car_number', + ), + ] diff --git a/FRONTEND/fastparking/accounts/migrations/0005_mycars_car_number.py b/FRONTEND/fastparking/accounts/migrations/0005_mycars_car_number.py new file mode 100644 index 00000000..b4d66609 --- /dev/null +++ b/FRONTEND/fastparking/accounts/migrations/0005_mycars_car_number.py @@ -0,0 +1,20 @@ +# Generated by Django 5.0.4 on 2024-04-13 14:50 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0004_remove_mycars_car_number'), + ('cars', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='mycars', + name='car_number', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cars.car'), + ), + ] diff --git a/FRONTEND/fastparking/accounts/migrations/__init__.py b/FRONTEND/fastparking/accounts/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/FRONTEND/fastparking/accounts/templates/accounts/report.html b/FRONTEND/fastparking/accounts/templates/accounts/report.html new file mode 100644 index 00000000..4eb7ee07 --- /dev/null +++ b/FRONTEND/fastparking/accounts/templates/accounts/report.html @@ -0,0 +1,37 @@ +{% extends "parking/base.html" %} +{% block content %} + {{ title }} + + +

{{ title }}

+ {% if entries %} + + + + + + + + + + + {% for entry in entries %} + + + + + + + {% endfor %} + +
Column 1Column 2Column 3
{{ entry.entry_time }}{{ entry.exit_time }}{{ entry.car_number }}
+ {% else %} +

No entries found.

+ {% endif %} + +
+ Report Car +
+ + +{% endblock content %} diff --git a/FRONTEND/fastparking/cars/migrations/0003_mycars.py b/FRONTEND/fastparking/cars/migrations/0003_mycars.py new file mode 100644 index 00000000..18559fb8 --- /dev/null +++ b/FRONTEND/fastparking/cars/migrations/0003_mycars.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.4 on 2024-04-14 16:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cars', '0002_rename_photo_car_photo_car_car_paypass_car_blocked'), + ] + + operations = [ + migrations.CreateModel( + name='MyCars', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ], + ), + ] diff --git a/FRONTEND/fastparking/cars/templates/cars/car_list.html b/FRONTEND/fastparking/cars/templates/cars/car_list.html index b97af5a7..12ec4b3c 100644 --- a/FRONTEND/fastparking/cars/templates/cars/car_list.html +++ b/FRONTEND/fastparking/cars/templates/cars/car_list.html @@ -4,7 +4,7 @@

List of Cars

-
+ diff --git a/FRONTEND/fastparking/cars/urls.py b/FRONTEND/fastparking/cars/urls.py index b2902ba6..d274e44b 100644 --- a/FRONTEND/fastparking/cars/urls.py +++ b/FRONTEND/fastparking/cars/urls.py @@ -1,11 +1,7 @@ from django.urls import path -from django.contrib.auth.views import LoginView, LogoutView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView - from .views import CarListView -# from .forms import LoginForm - -app_name = "cars" +app_name = 'cars' urlpatterns = [ path('', CarListView.as_view(), name='car_list'), diff --git a/FRONTEND/fastparking/communications/migrations/0001_initial.py b/FRONTEND/fastparking/communications/migrations/0001_initial.py new file mode 100644 index 00000000..ef2043cb --- /dev/null +++ b/FRONTEND/fastparking/communications/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 5.0.4 on 2024-04-13 19:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="Message", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("date_displayed", models.DateTimeField(auto_now_add=True)), + ("news_text", models.TextField()), + ("is_displayed", models.BooleanField(default=False)), + ], + ), + ] diff --git a/FRONTEND/fastparking/communications/migrations/0002_alter_message_date_displayed.py b/FRONTEND/fastparking/communications/migrations/0002_alter_message_date_displayed.py new file mode 100644 index 00000000..c56a5db4 --- /dev/null +++ b/FRONTEND/fastparking/communications/migrations/0002_alter_message_date_displayed.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.4 on 2024-04-13 21:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("communications", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="message", + name="date_displayed", + field=models.DateTimeField(blank=True, null=True), + ), + ] diff --git a/FRONTEND/fastparking/communications/migrations/__init__.py b/FRONTEND/fastparking/communications/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/FRONTEND/fastparking/communications/notifications.py b/FRONTEND/fastparking/communications/notifications.py new file mode 100644 index 00000000..b8ffd87e --- /dev/null +++ b/FRONTEND/fastparking/communications/notifications.py @@ -0,0 +1,8 @@ +from django.db.models import Q +from django.utils import timezone + +from utils.telegram_api import send_message_news + + +def send_limits(): + ... diff --git a/FRONTEND/fastparking/fastparking/settings.py b/FRONTEND/fastparking/fastparking/settings.py index 0aa74dff..994814e8 100644 --- a/FRONTEND/fastparking/fastparking/settings.py +++ b/FRONTEND/fastparking/fastparking/settings.py @@ -14,6 +14,7 @@ from dotenv import load_dotenv import os import tempfile +import configparser # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -21,7 +22,19 @@ if env_file.exists(): load_dotenv(env_file) +git_version = "" +GIT_VERSION_FILE = BASE_DIR.parent.joinpath("git-version.txt") +if GIT_VERSION_FILE.exists(): + git_version = GIT_VERSION_FILE.read_text().strip() +proj_version = "" +PYPROJECT_FILE = BASE_DIR.parent.joinpath("pyproject.toml") +if PYPROJECT_FILE.exists(): + config = configparser.ConfigParser() + config.read(PYPROJECT_FILE) + proj_version = config["tool.poetry"]["version"].strip('"') + +VERSION = f"{proj_version}-{git_version}" # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ @@ -40,7 +53,9 @@ DJANGO_ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS") if DJANGO_ALLOWED_HOSTS: ALLOWED_HOSTS = DJANGO_ALLOWED_HOSTS.split(",") - CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in DJANGO_ALLOWED_HOSTS.split(",")] + CSRF_TRUSTED_ORIGINS = [ + f"https://{host}" for host in DJANGO_ALLOWED_HOSTS.split(",") + ] else: ALLOWED_HOSTS = [] @@ -63,7 +78,7 @@ "accounts", ] -AUTH_USER_MODEL = 'users.CustomUser' +AUTH_USER_MODEL = "users.CustomUser" MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", @@ -192,14 +207,14 @@ } # print(f"{CACHES=}") -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" -EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = os.getenv("MAIL_SERVER") EMAIL_PORT = os.getenv("MAIL_PORT", 465) EMAIL_STARTTLS = False EMAIL_USE_SSL = True EMAIL_USE_TLS = False -EMAIL_HOST_USER = os.getenv('MAIL_USERNAME') -EMAIL_HOST_PASSWORD = os.getenv('MAIL_PASSWORD') +EMAIL_HOST_USER = os.getenv("MAIL_USERNAME") +EMAIL_HOST_PASSWORD = os.getenv("MAIL_PASSWORD") DEFAULT_FROM_EMAIL = EMAIL_HOST_USER diff --git a/FRONTEND/fastparking/finance/models.py b/FRONTEND/fastparking/finance/models.py index 1e3cf0a2..d8f55cdc 100644 --- a/FRONTEND/fastparking/finance/models.py +++ b/FRONTEND/fastparking/finance/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.urls import reverse from parking.models import Registration class Tariff(models.Model): @@ -10,6 +11,8 @@ class Tariff(models.Model): def __str__(self): return self.description + def get_absolute_url(self): + return reverse('tariff-detail', kwargs={'pk': self.pk}) class Payment(models.Model): # user_id = models.IntegerField(blank=True, null=True) # ID користувача, який здійснив оплату (не обов'язкове) @@ -20,3 +23,5 @@ class Payment(models.Model): def __str__(self): return f"Payment {self.id}" + def get_absolute_url(self): + return reverse('post', kwargs={'post_slug': self.id}) diff --git a/FRONTEND/fastparking/finance/templates/finance/add_pay.html b/FRONTEND/fastparking/finance/templates/finance/add_pay.html index 5e183c47..e2a008c6 100644 --- a/FRONTEND/fastparking/finance/templates/finance/add_pay.html +++ b/FRONTEND/fastparking/finance/templates/finance/add_pay.html @@ -1,10 +1,10 @@ {% extends "parking/base.html" %} {% block content %} -

Оплата

+

Payments

{% csrf_token %} {{ form.as_p }} - +
{% endblock content %} diff --git a/FRONTEND/fastparking/finance/templates/finance/add_tariff.html b/FRONTEND/fastparking/finance/templates/finance/add_tariff.html index c14cedce..22af7ef0 100644 --- a/FRONTEND/fastparking/finance/templates/finance/add_tariff.html +++ b/FRONTEND/fastparking/finance/templates/finance/add_tariff.html @@ -5,6 +5,6 @@

Add Tariff

{% csrf_token %} {{ form.as_p }} - +
{% endblock content %} diff --git a/FRONTEND/fastparking/finance/templates/finance/main.html b/FRONTEND/fastparking/finance/templates/finance/main.html index acde2e91..21189803 100644 --- a/FRONTEND/fastparking/finance/templates/finance/main.html +++ b/FRONTEND/fastparking/finance/templates/finance/main.html @@ -4,8 +4,8 @@

Main Page

diff --git a/FRONTEND/fastparking/parking/models.py b/FRONTEND/fastparking/parking/models.py index 5e4f4695..8b003303 100644 --- a/FRONTEND/fastparking/parking/models.py +++ b/FRONTEND/fastparking/parking/models.py @@ -1,3 +1,5 @@ +from django.contrib.auth.models import User + from django.db import models from photos.models import Photo from django.db import models diff --git a/FRONTEND/fastparking/parking/templates/parking/base.html b/FRONTEND/fastparking/parking/templates/parking/base.html index 00699231..4e4434bc 100644 --- a/FRONTEND/fastparking/parking/templates/parking/base.html +++ b/FRONTEND/fastparking/parking/templates/parking/base.html @@ -22,12 +22,12 @@

Sidebars examples

- +
+
+ + {{ form.telegram_nickname }} +
+ {{ form.errors.telegram_nickname }} +
+ Terms & Conditions
{{ form.errors.accept_oferta }}
+ +
@@ -62,4 +100,36 @@

SignUp

+ + {% endblock %} diff --git a/FRONTEND/fastparking/utils/sheduler.py b/FRONTEND/fastparking/utils/sheduler.py index ee9d34b8..7c3b8984 100644 --- a/FRONTEND/fastparking/utils/sheduler.py +++ b/FRONTEND/fastparking/utils/sheduler.py @@ -1,9 +1,12 @@ import time import argparse +import platform +from django.conf import settings from telegram_api import crone_pool, send_message_news from communications.send_news import send_news_to_telegram +from communications.notifications import send_limits def handler_telegram_pool(print_log: bool = False): @@ -15,6 +18,7 @@ def handler_telegram_pool(print_log: bool = False): def handler_limit_check(print_log: bool = False): if print_log: print("- handler_limit_check") + send_limits() def handler_news_check(print_log: bool = False): @@ -60,14 +64,12 @@ def handler_news_check(print_log: bool = False): ) parser.add_argument("-q", "--quite", action="store_true", help="Quite") args = parser.parse_args() - if args.sent_hello: - if __name__ == "__main__": - text = "Local developer run 'sheduler.py' at: " + version = settings.VERSION + if platform.system() != "Linux": + text = f"Local developer run 'sheduler.py' v.{version} at: " else: - text = ( - "Hosting server just applied new changes of git branch at: " - ) + text = f"Hosting server just applied new changes of git branch v.{version} at: " result = send_message_news(text) # print(f"{result=}") if args.loop: diff --git a/FRONTEND/fastparking/utils/telegram_api.py b/FRONTEND/fastparking/utils/telegram_api.py index 680ff88f..8a8b05e6 100644 --- a/FRONTEND/fastparking/utils/telegram_api.py +++ b/FRONTEND/fastparking/utils/telegram_api.py @@ -20,7 +20,6 @@ from communications.repository import ( find_user_by_telegram_id, - find_user_by_telegram_nickname, save_user_telegram_id, ) @@ -444,7 +443,21 @@ def handler_start(user_id: str, username: str | None = None): # answer_to_user(user_id, "\n".join(print_text)) +def check_registered_user(user_id: str) -> bool: + result = False + if user_id: + result = bool(find_user_by_telegram_id(user_id)) + if not result: + print_text = [ + "Ви ще не зареєстровані у системі", + "Тому всі результати є демонстраційними.\n", + ] + answer_to_user(user_id, "\n".join(print_text)) + return result + + def handler_begin(user_id: str, username: str | None = None): + check_registered_user(user_id) car_number = "AA0001BB" tariff_id = "1" parking_id = "L01-34" @@ -456,6 +469,7 @@ def handler_begin(user_id: str, username: str | None = None): def handler_stop(user_id: str, username: str | None = None): + check_registered_user(user_id) print_text = [parse_text("Команду STOP прийнято: ")] payed_uniq_id = cache.get("payed_uniq_id") if not payed_uniq_id: @@ -477,6 +491,7 @@ def handler_stop(user_id: str, username: str | None = None): def handler_pay(user_id: str, username: str | None = None): + check_registered_user(user_id) car_number = "AA0001BB" duration = 2 tariff_id = "1" @@ -503,6 +518,7 @@ def handler_help(user_id: str, username: str | None = None): def handler_cabinet(user_id: str, username: str | None = None): + check_registered_user(user_id) user_name = "Jon Travolta" cars_list = ["AA0001BB", "AA0002CC"] car_numbers = ", ".join(cars_list) @@ -560,6 +576,7 @@ def check_payments(): # print(qr_data) if qr_data: user_id = cache.get("user_id") + check_registered_user(user_id) cache.set("payment_id", None) cache.set("user_id", None) diff --git a/README.md b/README.md index 55a94549..7f8e9506 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ Plate license recognition ## env file На основі файлу `deploy/env-examples` створюємо власний `deploy/.env` з власними змінними - -## LOCAL DEVELOPMENT +
+

LOCAL DEVELOPMENT

- git проекту: https://github.com/AlexanderBgit/PlateN , default branch `dev` @@ -64,7 +64,11 @@ else: - Якщо у VC Code створити Workspace, додати до нього підпроєкти як (File->Add folder to WorkSpace), то при запуску терміналу буде запити з якої теки ви це хочете зробити. - Для роботи з локальною базою даних використовуємо настуні кроки (Local Database postgres). Для роботи з віддаленою базою даних пропускаємо ці кроки. -### Local Database postgres +
+ +
+

Local Database postgres

+ #### run database postgres docker container `scripts/docker_db.cmd` @@ -75,9 +79,10 @@ else: #### stop database postgres docker container `scripts\docker_db_stop.cmd` +
- -### Запуск та обслуговування застосунку в докер +
+

Запуск та обслуговування застосунку в докер

#### run app locally Запускати з віртуального оточення poetry @@ -116,9 +121,12 @@ python manage.py migrate ##### rebuild project (code) docker container `scripts\docker_app_build.cmd` +
-## Процедура підключення dev - Django з нуля: +
+

Процедура підключення dev - Django з нуля:

+ 1. git checkout dev 1. git pull 1. cd FRONTEND @@ -131,10 +139,16 @@ python manage.py migrate 1. create_django_auto_admin.cmd - create admin aromatically from .env 1. run_dev_app.cmd - run app 1. open browser: http://127.0.0.1:8000 +
+ +
+

SERVER SIDE DEPLOY - CI/CD

+ + +
+

CI перевірка коду

-## SERVER SIDE DEPLOY - CI/CD -### CI перевірка коду Перевірка коду проєкту на збирання проходить автоматично у кожному "GitHub pull request" безпосередньо перед об'єднанням з гілкою `dev` функцію Action GitHub. Але без повірки міграції. @@ -142,9 +156,11 @@ python manage.py migrate Action GitHub використовує налаштуванням з файлу `.github\workflows\django.yml` де проходить перевірка на збирання середовища виконання для трьох версії python: `python-version: ["3.10", "3.11"]`. Безпосереднє тестування проєкту Django автоматично виконується командую `python manage.py test`. +
+
+

CD

-### CD Сервер: Linux (Debian). Локальний користувач для виконання задач без прав адміністратора. @@ -171,5 +187,7 @@ SOURCE=${HOME}/PlateN/PlateN */15 * * * * ~/PlateN/detect_changes_git.sh > /dev/null 2>&1 ``` Що дозволяє запускати скрипт `detect_changes_git.sh` кожні 15 хвилин. +
+
diff --git a/scripts/docker_app.cmd b/scripts/docker_app.cmd index f276c500..9288be48 100644 --- a/scripts/docker_app.cmd +++ b/scripts/docker_app.cmd @@ -3,6 +3,7 @@ PUSHD "..\deploy" ECHO "STOPPING SEPARATED DEV DB CONTAINER" docker stop fastparking-db-postgres-1 +git rev-parse --short HEAD > ..\FRONTEND\git-version.txt rem docker-compose --file docker-compose-project.yml --env-file .env up -d docker-compose --file docker-compose-project.yml --env-file .env up POPD \ No newline at end of file diff --git a/scripts/docker_app.sh b/scripts/docker_app.sh index 2b4f942a..3c1fd0a6 100755 --- a/scripts/docker_app.sh +++ b/scripts/docker_app.sh @@ -3,6 +3,7 @@ pushd "../deploy" # echo "STOPPING SEPARATED DEV DB CONTAINER" # docker stop fastparking-db-postgres-1 +git rev-parse --short HEAD > ../FRONTEND/git-version.txt echo "STARTING" docker-compose --file docker-compose-project.yml --env-file .env up -d popd \ No newline at end of file diff --git a/scripts/docker_app_build.cmd b/scripts/docker_app_build.cmd index fd9a8fa9..5def987d 100644 --- a/scripts/docker_app_build.cmd +++ b/scripts/docker_app_build.cmd @@ -1,6 +1,6 @@ @echo off PUSHD "..\deploy" - +git rev-parse --short HEAD > ../FRONTEND/git-version.txt docker-compose --file docker-compose-project.yml --env-file .env build code rem timeout 1 rem docker attach fastparking-code-1 diff --git a/scripts/docker_app_build.sh b/scripts/docker_app_build.sh index 5b0b456b..5318da58 100755 --- a/scripts/docker_app_build.sh +++ b/scripts/docker_app_build.sh @@ -1,5 +1,6 @@ #!/bin/env bash pushd "../deploy" +git rev-parse --short HEAD > ../FRONTEND/git-version.txt docker-compose --file docker-compose-project.yml --env-file .env build code popd \ No newline at end of file diff --git a/scripts/docker_app_run.cmd b/scripts/docker_app_run.cmd index 704a3d77..b6647482 100644 --- a/scripts/docker_app_run.cmd +++ b/scripts/docker_app_run.cmd @@ -1,6 +1,6 @@ @echo off PUSHD "..\deploy" - +git rev-parse --short HEAD > ../FRONTEND/git-version.txt docker-compose --file docker-compose-project.yml --env-file .env run --rm code rem timeout 1 rem docker attach fastparking-code-1 diff --git a/scripts/docker_app_run.sh b/scripts/docker_app_run.sh index aee5a224..597691b7 100755 --- a/scripts/docker_app_run.sh +++ b/scripts/docker_app_run.sh @@ -1,5 +1,6 @@ #!/bin/bash pushd "../deploy" +git rev-parse --short HEAD > ../FRONTEND/git-version.txt docker-compose --file docker-compose-project.yml --env-file .env run --rm code popd \ No newline at end of file diff --git a/scripts/docker_db_stop.sh b/scripts/docker_db_stop.sh new file mode 100755 index 00000000..69e48612 --- /dev/null +++ b/scripts/docker_db_stop.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker stop fastparking-db-postgres-1 \ No newline at end of file diff --git a/scripts/run_dev_app.cmd b/scripts/run_dev_app.cmd index 309efc0d..b10dbb12 100644 --- a/scripts/run_dev_app.cmd +++ b/scripts/run_dev_app.cmd @@ -3,5 +3,6 @@ echo "runed poetry shell?" poetry env info -p echo "\Scripts\activate" PUSHD "../FRONTEND/fastparking" +git rev-parse --short HEAD > ..\git-version.txt python manage.py runserver 0.0.0.0:8000 POPD \ No newline at end of file diff --git a/scripts/run_dev_app.sh b/scripts/run_dev_app.sh index 38d4a976..9b352006 100755 --- a/scripts/run_dev_app.sh +++ b/scripts/run_dev_app.sh @@ -2,6 +2,7 @@ # simulate poetry shell pushd "../FRONTEND" +git rev-parse --short HEAD > git-version.txt pyact=$(poetry env info -p) source ${pyact}/bin/activate popd