mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
фикс авторизации5
This commit is contained in:
@@ -55,4 +55,12 @@ async def admin_login(
|
|||||||
return {
|
return {
|
||||||
"access_token": access_token,
|
"access_token": access_token,
|
||||||
"token_type": "bearer"
|
"token_type": "bearer"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def find_unique(nested, threshold):
|
||||||
|
unique = set() # Создаем пустое множество
|
||||||
|
for sublist in nested:
|
||||||
|
for num in sublist:
|
||||||
|
if num > threshold:
|
||||||
|
unique.add(num)
|
||||||
|
return unique
|
||||||
20
backend/scripts/init.sh
Normal file
20
backend/scripts/init.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ждем, пока база данных будет доступна
|
||||||
|
echo "Waiting for database..."
|
||||||
|
while ! nc -z db 5432; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Database is ready!"
|
||||||
|
|
||||||
|
# Применяем миграции
|
||||||
|
echo "Applying database migrations..."
|
||||||
|
cd /app
|
||||||
|
alembic upgrade head
|
||||||
|
|
||||||
|
echo "Migrations completed!"
|
||||||
|
|
||||||
|
# Запускаем приложение
|
||||||
|
echo "Starting application..."
|
||||||
|
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --workers 1
|
||||||
@@ -2,6 +2,9 @@ FROM python:3.11-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Устанавливаем необходимые пакеты
|
||||||
|
RUN apt-get update && apt-get install -y netcat-traditional && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Устанавливаем зависимости
|
# Устанавливаем зависимости
|
||||||
COPY backend/requirements.txt .
|
COPY backend/requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
@@ -9,16 +12,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
# Копируем код приложения
|
# Копируем код приложения
|
||||||
COPY backend/ .
|
COPY backend/ .
|
||||||
|
|
||||||
# Создаем entrypoint скрипт
|
# Делаем скрипт исполняемым
|
||||||
RUN echo '#!/bin/sh\n\
|
RUN chmod +x /app/scripts/init.sh
|
||||||
echo "Waiting for database..."\n\
|
|
||||||
sleep 10\n\
|
|
||||||
echo "Running database migrations..."\n\
|
|
||||||
alembic upgrade head\n\
|
|
||||||
echo "Starting application..."\n\
|
|
||||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --workers 1' > /entrypoint.sh \
|
|
||||||
&& chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
CMD ["/entrypoint.sh"]
|
CMD ["/app/scripts/init.sh"]
|
||||||
2
test_var.py
Normal file
2
test_var.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Попытка вывести неопределенную переменную
|
||||||
|
print(my_var) # Вызовет NameError
|
||||||
Reference in New Issue
Block a user