rename_dir

This commit is contained in:
zakhy 2025-03-14 16:54:28 +07:00
parent 3622b3be04
commit 988d024250
94 changed files with 90 additions and 65 deletions

2
.gitignore vendored
View File

@ -171,3 +171,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
static/admin/

View File

@ -31,7 +31,7 @@ repos:
rev: 7.1.2
hooks:
- id: flake8
exclude: "app/project/settings/__init__.py" # Исключает указанный файл из проверки.
exclude: "positioning/project/settings/__init__.py" # Исключает указанный файл из проверки.
args: [ "--ignore=E501,F821", "--max-line-length=120" ] # Игнорирует определенные ошибки.
# mypy — это статический анализатор типов для Python.

View File

@ -1,24 +0,0 @@
from django.db import models
class Department(models.Model):
"""Модель справочника Подразделения"""
name = models.CharField(max_length=150,
default=" ",
verbose_name="Наименование")
comments = models.TextField(max_length=1000,
blank=True,
verbose_name="Комментарий",
default=' ')
def __str__(self) -> str:
return self.name
class Meta:
ordering = ['name']
verbose_name = u'подразделение'
verbose_name_plural = u'подразделения'
indexes = [
models.Index(fields=['name']),
]

View File

@ -1,28 +0,0 @@
from django.db import models
from django.urls import \
reverse # Used to generate URLs by reversing the URL patterns
class Position(models.Model):
"""Модель справочника должности."""
name = models.CharField(max_length=150,
default=" ",
verbose_name="Наименование")
def __str__(self) -> str:
return self.name
def get_natural_key(self) -> list[str]:
return [self.name]
def __unicode__(self) -> str:
return self.name
class Meta: # отображение в админики
ordering = ['name']
verbose_name = u'должность'
verbose_name_plural = u'должности'
indexes = [
models.Index(fields=['name']),
]

View File

@ -2,7 +2,7 @@ version: '3.9'
services:
web:
build: ./app
build: ./positioning
image: positioning
command: >
sh -c "
@ -49,6 +49,17 @@ services:
retries: 3
start_period: 10s
nginx:
build: ./nginx/prod
volumes:
- ./static/:/home/static/
ports:
- "80:80"
- "443:443"
depends_on:
web:
condition: service_started
volumes:
postgres_data:
redis_data:

4
nginx/prod/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM nginx:latest
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

19
nginx/prod/nginx.conf Normal file
View File

@ -0,0 +1,19 @@
upstream gunicorn {
server web:8000;
}
server {
listen 80;
location / {
proxy_pass http://gunicorn;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /static/ {
alias /home/static/;
}
}

View File

@ -7,7 +7,7 @@ ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
WORKDIR /positioning
COPY pyproject.toml poetry.lock ./
RUN touch README.md
@ -16,10 +16,10 @@ RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --n
FROM python:3.10.16-alpine3.21 as runtime
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
ENV VIRTUAL_ENV=/positioning/.venv \
PATH="/positioning/.venv/bin:$PATH"
WORKDIR /app
WORKDIR /positioning
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY . .

View File

@ -1,9 +1,6 @@
from django.urls import path
from apps.main.views import MainIndexView
from django.urls import path
app_name = "main"
urlpatterns = [
path("", MainIndexView.as_view(), name="main_index")
]
urlpatterns = [path("", MainIndexView.as_view(), name="main_index")]

View File

@ -1,11 +1,10 @@
# Generated by Django 4.2.19 on 2025-03-07 05:19
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []

View File

@ -0,0 +1,21 @@
from django.db import models
class Department(models.Model):
"""Модель справочника Подразделения"""
name = models.CharField(max_length=150, default=" ", verbose_name="Наименование")
comments = models.TextField(
max_length=1000, blank=True, verbose_name="Комментарий", default=" "
)
def __str__(self) -> str:
return self.name
class Meta:
ordering = ["name"]
verbose_name = "подразделение"
verbose_name_plural = "подразделения"
indexes = [
models.Index(fields=["name"]),
]

View File

@ -0,0 +1,24 @@
from django.db import models
class Position(models.Model):
"""Модель справочника должности."""
name = models.CharField(max_length=150, default=" ", verbose_name="Наименование")
def __str__(self) -> str:
return self.name
def get_natural_key(self) -> list[str]:
return [self.name]
def __unicode__(self) -> str:
return self.name
class Meta: # отображение в админики
ordering = ["name"]
verbose_name = "должность"
verbose_name_plural = "должности"
indexes = [
models.Index(fields=["name"]),
]