feat [P-282]: надо править бэк2
This commit is contained in:
commit
10520599b6
14 files changed
+60
-107
No files matched your search
@@ -39,7 +39,7 @@ REDISBROKER="redis://redis"
|
||||
REDIS_PORT=6379
|
||||
REDIS_BASE=0
|
||||
|
||||
AUTO_BACKEND=True
|
||||
AUTO_BACKEND="True"
|
||||
|
||||
FRONTEND_EXTERNAL_PORT=3000
|
||||
FRONTEND_INTERNAL_PORT=3000
|
||||
@@ -56,3 +56,7 @@ NGINX_INTERNAL_PORT=80
|
||||
|
||||
RUN_WITH_DOCS=False
|
||||
PRODUCTION=True
|
||||
|
||||
MYDEBUG=False
|
||||
DJANGO_CSRF_TRUSTED_ORIGINS="http://localhost, http://portal-t, http://127.0.0.1, http://portal9966/"
|
||||
DJANGO_ALLOWED_HOSTS="*, portal-t, portal9966, localhost, 0.0.0.0"
|
||||
@@ -7,8 +7,7 @@ ENV SOURCE_DIR=${SOURCE_DIR}
|
||||
# Устанавливаем рабочую директорию
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libmariadb-dev-compat \
|
||||
build-essential \
|
||||
dos2unix \
|
||||
build-essential \
|
||||
pkg-config && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
@@ -18,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
COPY ${SOURCE_DIR}/pyproject.toml ${SOURCE_DIR}/README.md ./
|
||||
COPY docker/entries/backend-entrypoint.sh /script/backend-entrypoint.sh
|
||||
|
||||
RUN dos2unix /script/backend-entrypoint.sh && chmod 777 /script/backend-entrypoint.sh && \
|
||||
RUN chmod 777 /script/backend-entrypoint.sh && \
|
||||
python -m pip install --no-cache-dir poetry \
|
||||
&& poetry config virtualenvs.in-project true \
|
||||
&& poetry install --no-interaction --no-ansi
|
||||
|
||||
@@ -54,7 +54,7 @@ class CustomAuth(ModelBackend):
|
||||
status_code=0
|
||||
|
||||
# !ТУт стучим в AD, потом к Алексею
|
||||
if myDEBUG!=True:
|
||||
if myDEBUG!="True":
|
||||
|
||||
resp= requests.post('http://10.252.44.13:8005/getAD', json.dumps({'user': username, 'password':password, 'usercheck': username}))
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Generated by Django 4.2.3 on 2025-01-31 09:54
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vote', '0002_initial'),
|
||||
('navigation', '0002_news_vote'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='news',
|
||||
name='vote',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='vote.vote'),
|
||||
),
|
||||
]
|
||||
@@ -1,17 +0,0 @@
|
||||
# Generated by Django 4.2.3 on 2025-02-11 12:02
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('navigation', '0003_news_vote'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='news',
|
||||
name='vote',
|
||||
),
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
from datetime import timedelta
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class Settings:
|
||||
"""
|
||||
Настройки подключений - потом перенести
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
Настройки подключений - потом перенести
|
||||
"""
|
||||
self.secret_key = "V7bvDZMztr3EU8S9g1Dipw"
|
||||
self.redis_hosts = [f"{str(os.getenv('REDIS'))}:{str(os.getenv('REDIS_PORT'))}"]
|
||||
self.access_token_lifetime = timedelta(minutes=480)
|
||||
|
||||
self.refresh_token_lifetime = timedelta(days=1)
|
||||
|
||||
self.db = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.mysql",
|
||||
"NAME": os.getenv("DB_NAME"), # Имя базы данных
|
||||
"USER": os.getenv("DB_USER"), # Имя пользователя
|
||||
"PASSWORD": os.getenv("DB_PASSWORD"), # Пароль
|
||||
"HOST": os.getenv("DB_HOST"), # Хост
|
||||
"PORT": os.getenv("DB_INTERNAL_PORT"), # Порт
|
||||
}
|
||||
}
|
||||
|
||||
def foo1(self) -> None:
|
||||
"""
|
||||
Настройки - потом перенести
|
||||
"""
|
||||
return None
|
||||
|
||||
def foo2(self) -> None:
|
||||
"""
|
||||
Настройки подключений - потом перенести
|
||||
"""
|
||||
return None
|
||||
+20
-14
@@ -12,18 +12,18 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
from .ds import Settings
|
||||
stngs = Settings()
|
||||
|
||||
DATA_UPLOAD_MAX_NUMBER_FIELDS=100000
|
||||
CORS_ORIGIN_ALLOW_ALL=True
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
LIST_PER_PAGE=25
|
||||
SECRET_KEY=stngs.secret_key
|
||||
SECRET_KEY="V7bvDZMztr3EU8S9g1Dipw"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
myDEBUG=True
|
||||
myDEBUG=os.getenv("MYDEBUG")
|
||||
|
||||
SWAGGER_SETTINGS = {
|
||||
'DEFAULT_INFO': 'import.path.to.urls.api_info',
|
||||
@@ -38,17 +38,13 @@ SWAGGER_SETTINGS = {
|
||||
}
|
||||
}
|
||||
}
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
'http://localhost',
|
||||
'http://127.0.0.1',
|
||||
'http://yourdomain.com', # Add your production domain here
|
||||
]
|
||||
ALLOWED_HOSTS = ["*","portal-t",'portal9966','localhost','0.0.0.0']
|
||||
ALLOWED_HOSTS = str(os.getenv('DJANGO_ALLOWED_HOSTS')).split(', ')
|
||||
CSRF_TRUSTED_ORIGINS = str(os.getenv('DJANGO_CSRF_TRUSTED_ORIGINS')).split(', ')
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts":stngs.redis_hosts,
|
||||
"hosts":[f"{str(os.getenv('REDIS'))}:{str(os.getenv('REDIS_PORT'))}"]
|
||||
},
|
||||
},
|
||||
|
||||
@@ -141,7 +137,17 @@ ASGI_APPLICATION = "portal.asgi.application"
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
DATABASES = stngs.db
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.mysql",
|
||||
"NAME": os.getenv("DB_NAME"), # Имя базы данных
|
||||
"USER": os.getenv("DB_USER"), # Имя пользователя
|
||||
"PASSWORD": os.getenv("DB_PASSWORD"), # Пароль
|
||||
"HOST": os.getenv("DB_HOST"), # Хост
|
||||
"PORT": os.getenv("DB_INTERNAL_PORT"), # Порт
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Password validation
|
||||
@@ -198,8 +204,8 @@ from datetime import timedelta
|
||||
|
||||
|
||||
SIMPLE_JWT = {
|
||||
"ACCESS_TOKEN_LIFETIME": stngs.access_token_lifetime,
|
||||
"REFRESH_TOKEN_LIFETIME": stngs.refresh_token_lifetime,
|
||||
"ACCESS_TOKEN_LIFETIME": timedelta(hours=4),
|
||||
"REFRESH_TOKEN_LIFETIME": timedelta(days=1),
|
||||
"ROTATE_REFRESH_TOKENS": False,
|
||||
"BLACKLIST_AFTER_ROTATION": False,
|
||||
"UPDATE_LAST_LOGIN": False,
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.db import migrations, models
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("navigation", "0004_remove_news_vote"),
|
||||
|
||||
("tests", "0004_test_is_available"),
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.2.4 on 2025-08-01 10:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("tests", "0009_alter_testquestion_name"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="test",
|
||||
name="name",
|
||||
field=models.CharField(max_length=500, verbose_name="Название теста"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="testanswer",
|
||||
name="name",
|
||||
field=models.TextField(verbose_name="Ответ"),
|
||||
),
|
||||
]
|
||||
@@ -12,7 +12,7 @@ class Test(models.Model):
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name='Лого Теста')
|
||||
name = models.CharField(max_length=255, blank=False, verbose_name="Название теста")
|
||||
name = models.CharField(max_length=500, blank=False, verbose_name="Название теста")
|
||||
description = models.TextField(verbose_name='Описание')
|
||||
author = models.ForeignKey(User, on_delete=models.CASCADE,
|
||||
verbose_name='Создатель тестирования')
|
||||
@@ -51,7 +51,7 @@ class TestQuestion(models.Model):
|
||||
|
||||
class TestAnswer(models.Model):
|
||||
"""answer options for the question"""
|
||||
name = models.CharField(max_length=255, blank=False, verbose_name="Ответ")
|
||||
name = models.TextField(blank=False, verbose_name="Ответ")
|
||||
file = models.FileField(upload_to='tests/answer_files/',
|
||||
null=True,
|
||||
blank=True,
|
||||
|
||||
@@ -7,7 +7,7 @@ import django.db.models.deletion
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('navigation', '0004_remove_news_vote'),
|
||||
|
||||
('vote', '0002_initial'),
|
||||
]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { VCalendar } from 'vuetify/labs/VCalendar'
|
||||
|
||||
import { createVuetify } from 'vuetify'
|
||||
import { ru } from 'vuetify/locale'
|
||||
// import { VTimePicker } from 'vuetify/labs/VTimePicker'
|
||||
|
||||
|
||||
export default createVuetify({
|
||||
|
||||
@@ -13,7 +13,7 @@ export default createVuetify({
|
||||
},
|
||||
components: {
|
||||
VCalendar,
|
||||
// VTimePicker,
|
||||
|
||||
},
|
||||
theme: {
|
||||
defaultTheme: 'light',
|
||||
|
||||
@@ -3,8 +3,8 @@ import axios from "axios";
|
||||
|
||||
const spravURL = 'http://10.252.44.33/accounting6/images/photo/'
|
||||
const spravURLBase = 'http://10.252.44.33/accounting6/'
|
||||
const baseURL = process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:8000/' : `http://${window.location.host}/`;
|
||||
const baseWS = process.env.NODE_ENV === 'development' ? 'ws://localhost/' : `ws://${window.location.host}/`;
|
||||
const baseURL = `http://${window.location.host}/`;
|
||||
const baseWS = `ws://${window.location.host}/`;
|
||||
// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`;
|
||||
// const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`;
|
||||
// для релизного меняем 'http://ukd/'
|
||||
|
||||
Reference in new issue
Block a user