feat: добавить auth функционал, URL и Docker конфигурацию
Some checks failed
Build and Push Docker Image / build (push) Failing after 12s

- Добавлены views, URL и страницы для входа, регистрации, профиля
- Обновлён основной маршрут users/urls.py
- Перенаправлен маршрут catalog вместо items
- Обновлена структура header с добавлением ссылки на главную
- Создан Dockerfile и workflow для сборки и доставки образов
This commit is contained in:
2026-03-30 22:32:31 +02:00
parent d522489e7f
commit 28c4e08bb6
11 changed files with 162 additions and 4 deletions

View File

@@ -0,0 +1,34 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ vars.REGISTRY_URL }}/${{ github.repository_owner }}/santeh-ray:latest
cache-from: type=gha
cache-to: type=gha,mode=max

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV HOST=0.0.0.0
ENV PORT=8000
EXPOSE ${PORT}
CMD uvicorn santehray.asgi:application --host ${HOST} --port ${PORT}

View File

@@ -19,8 +19,8 @@ from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include('home.urls')), path('', include('home.urls')),
path('admin/', admin.site.urls), path('catalog/', include('items.urls')),
path('items/', include('items.urls')),
path('orders/', include('orders.urls')), path('orders/', include('orders.urls')),
path('users/', include('users.urls')), path('users/', include('users.urls')),
path('admin/', admin.site.urls),
] ]

36
static/css/login.css Normal file
View File

@@ -0,0 +1,36 @@
.login-form {
padding: 25px;
border: 1px solid rgba(94, 80, 125, 0.78);
& > h2 {
text-align: center;
font-weight: 400;
font-size: 44px;
color: #36213e;
}
}
.form-group {
display: flex;
flex-direction: column;
gap: 5px;
margin-top: 10px;
}
.form-label {
font-weight: 400;
font-size: 18px;
line-height: 22px;
text-align: left;
color: #554971;
}
.form-input {
background: #d9d9d9;
border: 1px solid #554971;
padding: 5px;
}

View File

@@ -50,6 +50,23 @@ a {
text-decoration: underline; text-decoration: underline;
} }
.full-page {
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.center-wrapper {
display: flex;
width: 100%;
height: 100%;
flex-direction: column;
justify-content: center;
align-items: center;
}
/* ── HEADER ── */ /* ── HEADER ── */
header { header {
position: sticky; position: sticky;

View File

@@ -2,7 +2,7 @@
<header> <header>
<div class="container"> <div class="container">
<div class="header-top"> <div class="header-top">
<div class="logo">SantehRay</div> <div class="logo"><a href="/">SantehRay</a></div>
<form action=""> <form action="">
<div class="search-wrap"> <div class="search-wrap">
<label> <label>

View File

@@ -0,0 +1,39 @@
{% extends '_layouts/base.html' %}
{% load static %}
{% block title %}Вход{% endblock %}
{% block add_css %}
<link rel="stylesheet" href="{% static 'css/login.css' %}">
{% endblock %}
{% block content %}
<div class="full-page">
{% include "_fragments/header.html" %}
<div class="center-wrapper">
<form class="login-form" action="">
<h2>ВХОД</h2>
<div class="form-group">
<label class="form-label" for="login">Логин</label>
<input class="form-input" type="text" id="login">
</div>
<div class="form-group">
<label class="form-label" for="password">Пароль</label>
<input class="form-input" type="password" id="password">
</div>
<div class="form-group">
<div>
<input class="form-input" type="checkbox" id="persist">
<label class="form-label" for="persist">Оставаться в системе</label>
</div>
</div>
<div class="form-group">
<button type="submit">Войти</button>
</div>
</form>
</div>
{% include "_fragments/footer.html" %}
</div>
{% endblock %}

View File

View File

View File

@@ -1,3 +1,9 @@
from django.urls import path
from users import views
urlpatterns = [] urlpatterns = [
path('login/', views.login, name='login'),
path('register/', views.register, name='register'),
path('profile/', views.profile, name='profile')
]

View File

@@ -1,3 +1,14 @@
from django.shortcuts import render from django.shortcuts import render
# Create your views here. # Create your views here.
def login(request):
return render(request, 'users/login.html', context={})
def register(request):
return render(request, 'users/register.html', context={})
def profile(request):
return render(request, 'users/profile.html', context={})