diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b71b67..f15570a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,6 @@ stages: variables: SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - DB_HOST: "postgres" - RABBIT_HOST: "rabbitmq" build: stage: build @@ -36,9 +34,7 @@ deploy-dev: variables: PORT: 80 SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - DB_HOST: "postgres" - RABBIT_HOST: "rabbitmq" - FS_HOST: "http://storage" + HOST: "77.246.159.65" deploy-prod: extends: diff --git a/Main/models/userinfo.py b/Main/models/userinfo.py index ffdfdec..0bf7cda 100644 --- a/Main/models/userinfo.py +++ b/Main/models/userinfo.py @@ -21,7 +21,7 @@ class UserInfo(models.Model): notification_solution_result = models.BooleanField(default=False) def _append_task(self, task, tasks): - if task.creator == self.user or task.public: + if task.creator == self.user or task.public or self.user.is_superuser: tasks.append(task) return for st in SetTask.objects.filter(task=task): diff --git a/Sprint/settings.py b/Sprint/settings.py index 18847a2..d0657dc 100644 --- a/Sprint/settings.py +++ b/Sprint/settings.py @@ -16,6 +16,9 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +HOST = os.getenv("HOST", "0.0.0.0") + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ @@ -83,7 +86,7 @@ DATABASES = { "NAME": "sprint", "USER": "postgres", "PASSWORD": os.getenv("DB_PASSWORD", "password"), - "HOST": os.getenv("DB_HOST", "0.0.0.0"), + "HOST": HOST, "PORT": 5432, } } @@ -140,7 +143,7 @@ for root in DATA_ROOT, EXTRA_FILES_ROOT, MEDIA_ROOT: SOLUTIONS_ROOT = os.path.join(DATA_ROOT, "solutions") -RABBIT_HOST = os.getenv("RABBIT_HOST", "0.0.0.0") +RABBIT_HOST = HOST RABBIT_PORT = 5672 FS_HOST = os.getenv("FS_HOST", "http://0.0.0.0") diff --git a/docker-compose.yaml b/docker-compose.yaml index 0267d38..682ca08 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,9 +22,13 @@ services: restart: always environment: PORT: $PORT +<<<<<<< HEAD DB_HOST: $DB_HOST RABBIT_HOST: $RABBIT_HOST FS_HOST: $FS_HOST +======= + HOST: $HOST +>>>>>>> a512261c4d4b443cf25874181acd50485f1b40a4 command: scripts/runserver.sh ports: - "${PORT}:${PORT}" @@ -47,6 +51,8 @@ services: bot: image: mathwave/sprint-repo:sprint restart: always + environment: + HOST: $HOST command: python manage.py bot depends_on: - web @@ -67,9 +73,7 @@ services: command: scripts/create_worker.sh environment: SOLUTIONS_ROOT_EXTERNAL: "${SOLUTIONS_ROOT_EXTERNAL}" - DB_HOST: "${DB_HOST}" - RABBIT_HOST: "${RABBIT_HOST}" - FS_HOST: "${FS_HOST}" + HOST: $HOST depends_on: - web - rabbitmq diff --git a/templates/account.html b/templates/account.html index bd65305..3e7585e 100644 --- a/templates/account.html +++ b/templates/account.html @@ -24,6 +24,9 @@

{{ account.userinfo.surname }} {{ account.userinfo.name }} {{ account.userinfo.middle_name }} {{ account.userinfo.activity_status }} + {% if user.is_superuser %} + Админ + {% endif %}

diff --git a/templates/sets.html b/templates/sets.html index e0e115b..9952eb6 100644 --- a/templates/sets.html +++ b/templates/sets.html @@ -1,5 +1,7 @@ {% extends 'base_main.html' %} +{% block title %}сеты{% endblock %} + {% block main %}
@@ -44,4 +46,4 @@ {% for set in user.userinfo.available_sets %} {{ set.name }} {% if set.creator == user %} {% endif %}
{% endfor %} -{% endblock %} \ No newline at end of file +{% endblock %}