Merge branch 'Idealizm'

Докеризация

# Conflicts:
#	app/apps/events/views/views_events.py
#	app/apps/gto/migrations/0027_auto_20250721_2141.py
#	app/apps/gto/migrations/0028_alter_modeltypeicons_model.py
#	app/apps/gto/models/model_gto_external_system.py
#	app/apps/management/templates/gto_icons.html
#	app/apps/management/templates/icon_add.html
#	app/apps/management/templates/icons/remove_icon.html
#	app/apps/management/views/views_general.py
#	app/apps/management/views/views_geoproc.py
#	app/apps/management/views/views_gto.py
#	app/apps/management/views/views_pla.py
#	app/apps/management/views/views_seismicproc.py
#	app/apps/management/views/views_wklocation.py
#	app/mfssogr/urls.py
#	apps/management/templates/gto/gto_icons.html
#	apps/management/templates/gto/icon_add.html
#	apps/management/templates/gto_icons.html
#	apps/management/templates/icon_add.html
This commit is contained in:
zakhy 2025-07-24 15:23:47 +07:00
commit 5069a82ae6
3651 changed files with 1085 additions and 2780 deletions

5
.gitignore vendored
View File

@ -21,10 +21,9 @@ test*
/.vscode
.vscode
.env
docker.env
test_data
.idea
docker-compose.yml
app/venv
media
log
png_and_tifs
dxfs

31
.gitlab-ci.yaml Normal file
View File

@ -0,0 +1,31 @@
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."

3
app/.dockerignore Normal file
View File

@ -0,0 +1,3 @@
gdal/
mfssogr/local_settings.py
venv/

47
app/Dockerfile Normal file
View File

@ -0,0 +1,47 @@
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
GDAL_VERSION=3.6.2 \
CPLUS_INCLUDE_PATH=/usr/include/gdal \
C_INCLUDE_PATH=/usr/include/gdal \
PROJ_LIB=/usr/share/proj \
GDAL_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libgdal.so \
GEOS_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libgeos_c.so
RUN apt-get update && apt-get install -y \
git \
libgdal-dev \
gdal-bin \
libproj-dev \
proj-bin \
proj-data \
libgeos-dev \
binutils \
python3-pip \
python3-venv \
tzdata \
&& rm -rf /var/lib/apt/lists/*
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --no-cache "gdal==${GDAL_VERSION}"
RUN addgroup --system app && adduser --system --group app
ENV APP_HOME=/home/app
WORKDIR $APP_HOME
RUN mkdir "/home/app/coolsite_cache"
COPY --chown=app:app ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
USER app
COPY --chown=app:app . $APP_HOME

View File

@ -466,7 +466,7 @@ def view_events(request):
})
event.viewed = True
if event.read_date_time is None:
event.read_date_time =datetime.now()
event.read_date_time = timezone.now()
event.save()
return render(request,'event_view.html', context)

View File

@ -1,6 +1,6 @@
import os
from django.db import ProgrammingError
from apps.general.models.model_settings import Settings
from apps.geoproc.models.model_sector import Sector
@ -16,19 +16,22 @@ def set_settings(name, value):
def get_settings(name, default):
settings_token = Settings.objects.filter(name=name).first()
if settings_token is None:
Settings.objects.create(name=name, value=default)
result = default
else:
result = settings_token.value
try:
settings_token = Settings.objects.filter(name=name).first()
if settings_token is None:
Settings.objects.create(name=name, value=default)
result = default
else:
result = settings_token.value
if result == "False":
return False
elif result == "True":
return True
else:
return result
if result == "False":
return False
elif result == "True":
return True
else:
return result
except ProgrammingError:
return ""
def get_all_settings():

Some files were not shown because too many files have changed in this diff Show More