locadm 1 ano atrás
commit
fe6d716a4c
39 arquivos alterados com 783 adições e 0 exclusões
  1. 8 0
      .idea/.gitignore
  2. 6 0
      .idea/inspectionProfiles/profiles_settings.xml
  3. 7 0
      .idea/misc.xml
  4. 8 0
      .idea/modules.xml
  5. 10 0
      .idea/pythonProject.iml
  6. 6 0
      .idea/vcs.xml
  7. 0 0
      project/app/__init__.py
  8. 7 0
      project/app/admin.py
  9. 6 0
      project/app/apps.py
  10. 22 0
      project/app/forms.py
  11. 188 0
      project/app/migrations/0001_initial.py
  12. 0 0
      project/app/migrations/__init__.py
  13. 22 0
      project/app/models.py
  14. 16 0
      project/app/templates/app/product_list.html
  15. 88 0
      project/app/templates/base.html
  16. 28 0
      project/app/templates/profile.html
  17. 5 0
      project/app/templates/registration/log.html
  18. 10 0
      project/app/templates/registration/login.html
  19. 10 0
      project/app/templates/registration/register.html
  20. 19 0
      project/app/templates/search.html
  21. 20 0
      project/app/templates/service.html
  22. 3 0
      project/app/tests.py
  23. 15 0
      project/app/urls.py
  24. 68 0
      project/app/views.py
  25. BIN
      project/db.sqlite3
  26. 22 0
      project/manage.py
  27. BIN
      project/media/media/изображение_2023-12-26_094806025.png
  28. BIN
      project/media/media/изображение_2023-12-26_095108453.png
  29. BIN
      project/media/media/изображение_2023-12-26_095112277.png
  30. BIN
      project/media/media/изображение_2023-12-26_095115805.png
  31. BIN
      project/media/media/изображение_2023-12-26_095119125.png
  32. BIN
      project/media/media/изображение_2023-12-26_095122189.png
  33. BIN
      project/media/media/изображение_2023-12-26_095126989.png
  34. BIN
      project/media/media/изображение_2023-12-26_102618180.png
  35. 0 0
      project/project/__init__.py
  36. 16 0
      project/project/asgi.py
  37. 133 0
      project/project/settings.py
  38. 24 0
      project/project/urls.py
  39. 16 0
      project/project/wsgi.py

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 6 - 0
.idea/inspectionProfiles/profiles_settings.xml

@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="USE_PROJECT_PROFILE" value="false" />
+    <version value="1.0" />
+  </settings>
+</component>

+ 7 - 0
.idea/misc.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Black">
+    <option name="sdkName" value="Python 3.12 (pythonProject)" />
+  </component>
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (pythonProject)" project-jdk-type="Python SDK" />
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/.idea/pythonProject.iml" />
+    </modules>
+  </component>
+</project>

+ 10 - 0
.idea/pythonProject.iml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.venv" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 0 - 0
project/app/__init__.py


+ 7 - 0
project/app/admin.py

@@ -0,0 +1,7 @@
+from django.contrib import admin
+from .models import *
+# Register your models here.
+
+admin.site.register(Product)
+admin.site.register(Basket)
+admin.site.register(AbUser)

+ 6 - 0
project/app/apps.py

@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AppConfig(AppConfig):
+    default_auto_field = "django.db.models.BigAutoField"
+    name = "app"

+ 22 - 0
project/app/forms.py

@@ -0,0 +1,22 @@
+from django import forms
+
+from .models import AbUser
+
+
+
+class RegistrateForm(forms.ModelForm):
+    class Meta:
+        model = AbUser
+        fields = ('username', 'password', 'foto')
+
+    def __int__(self, *args, **kwargs):
+        super().__int__(*args, **kwargs)
+        for field in self.fields:
+            self.fields[field].widget.attrs['class'] = 'form-control'
+
+    def save(self, commit=True):
+        user = super().save(commit=False)
+        user.set_password(self.cleaned_data['password'])
+        if commit:
+            user.save()
+        return user

+ 188 - 0
project/app/migrations/0001_initial.py

@@ -0,0 +1,188 @@
+# Generated by Django 5.0 on 2023-12-26 02:01
+
+import django.contrib.auth.models
+import django.contrib.auth.validators
+import django.db.models.deletion
+import django.utils.timezone
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    initial = True
+
+    dependencies = [
+        ("auth", "0012_alter_user_first_name_max_length"),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name="Product",
+            fields=[
+                (
+                    "id",
+                    models.BigAutoField(
+                        auto_created=True,
+                        primary_key=True,
+                        serialize=False,
+                        verbose_name="ID",
+                    ),
+                ),
+                ("name", models.CharField(max_length=255)),
+                ("date", models.DateTimeField(auto_now_add=True)),
+                ("description", models.TextField(max_length=1000)),
+                (
+                    "type",
+                    models.CharField(
+                        choices=[("Товар", "Товар"), ("Услуга", "Услуга")], max_length=6
+                    ),
+                ),
+                ("image", models.ImageField(upload_to="media/")),
+            ],
+        ),
+        migrations.CreateModel(
+            name="AbUser",
+            fields=[
+                (
+                    "id",
+                    models.BigAutoField(
+                        auto_created=True,
+                        primary_key=True,
+                        serialize=False,
+                        verbose_name="ID",
+                    ),
+                ),
+                ("password", models.CharField(max_length=128, verbose_name="password")),
+                (
+                    "last_login",
+                    models.DateTimeField(
+                        blank=True, null=True, verbose_name="last login"
+                    ),
+                ),
+                (
+                    "is_superuser",
+                    models.BooleanField(
+                        default=False,
+                        help_text="Designates that this user has all permissions without explicitly assigning them.",
+                        verbose_name="superuser status",
+                    ),
+                ),
+                (
+                    "username",
+                    models.CharField(
+                        error_messages={
+                            "unique": "A user with that username already exists."
+                        },
+                        help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
+                        max_length=150,
+                        unique=True,
+                        validators=[
+                            django.contrib.auth.validators.UnicodeUsernameValidator()
+                        ],
+                        verbose_name="username",
+                    ),
+                ),
+                (
+                    "first_name",
+                    models.CharField(
+                        blank=True, max_length=150, verbose_name="first name"
+                    ),
+                ),
+                (
+                    "last_name",
+                    models.CharField(
+                        blank=True, max_length=150, verbose_name="last name"
+                    ),
+                ),
+                (
+                    "email",
+                    models.EmailField(
+                        blank=True, max_length=254, verbose_name="email address"
+                    ),
+                ),
+                (
+                    "is_staff",
+                    models.BooleanField(
+                        default=False,
+                        help_text="Designates whether the user can log into this admin site.",
+                        verbose_name="staff status",
+                    ),
+                ),
+                (
+                    "is_active",
+                    models.BooleanField(
+                        default=True,
+                        help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
+                        verbose_name="active",
+                    ),
+                ),
+                (
+                    "date_joined",
+                    models.DateTimeField(
+                        default=django.utils.timezone.now, verbose_name="date joined"
+                    ),
+                ),
+                ("foto", models.ImageField(upload_to="media/")),
+                (
+                    "groups",
+                    models.ManyToManyField(
+                        blank=True,
+                        help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
+                        related_name="user_set",
+                        related_query_name="user",
+                        to="auth.group",
+                        verbose_name="groups",
+                    ),
+                ),
+                (
+                    "user_permissions",
+                    models.ManyToManyField(
+                        blank=True,
+                        help_text="Specific permissions for this user.",
+                        related_name="user_set",
+                        related_query_name="user",
+                        to="auth.permission",
+                        verbose_name="user permissions",
+                    ),
+                ),
+            ],
+            options={
+                "verbose_name": "user",
+                "verbose_name_plural": "users",
+                "abstract": False,
+            },
+            managers=[
+                ("objects", django.contrib.auth.models.UserManager()),
+            ],
+        ),
+        migrations.CreateModel(
+            name="Basket",
+            fields=[
+                (
+                    "id",
+                    models.BigAutoField(
+                        auto_created=True,
+                        primary_key=True,
+                        serialize=False,
+                        verbose_name="ID",
+                    ),
+                ),
+                (
+                    "user",
+                    models.ForeignKey(
+                        null=True,
+                        on_delete=django.db.models.deletion.SET_NULL,
+                        to=settings.AUTH_USER_MODEL,
+                    ),
+                ),
+                (
+                    "product",
+                    models.ForeignKey(
+                        null=True,
+                        on_delete=django.db.models.deletion.SET_NULL,
+                        to="app.product",
+                    ),
+                ),
+            ],
+        ),
+    ]

+ 0 - 0
project/app/migrations/__init__.py


+ 22 - 0
project/app/models.py

@@ -0,0 +1,22 @@
+from django.db import models
+
+# Create your models here.
+from django.db import models
+from django.contrib.auth.models import AbstractUser
+# Create your models here.
+class AbUser(AbstractUser):
+    foto = models.ImageField(upload_to='media/')
+class Product(models.Model):
+    name = models.CharField(max_length=255, blank=False, null=False)
+    date = models.DateTimeField(auto_now_add=True, null=False)
+    description = models.TextField(max_length=1000, blank=False, null=False)
+    types = (('Товар', 'Товар'), ('Услуга', 'Услуга'))
+    type = models.CharField(choices=types, max_length=6)
+    image = models.ImageField(upload_to='media/', null=True,blank=True)
+
+    def __str__(self):
+        return self.name
+
+class Basket(models.Model):
+    product = models.ForeignKey('Product', on_delete=models.SET_NULL, null=True)
+    user = models.ForeignKey('AbUser', on_delete=models.SET_NULL, null=True)

+ 16 - 0
project/app/templates/app/product_list.html

@@ -0,0 +1,16 @@
+{% extends 'base.html'%}
+{% block content%}
+<h2>О товаре </h2>
+         <div class="card d-flex justify-content-center" style="width: 18rem;">
+             <h5 class="card-title d-flex justify-content-center">{{product.name}}</h5>
+              {% if product.image %}
+                <img class="d-flex justify-content-center mx-auto " src="{{product.image.url}}" width="280px" height="350px" ><br>
+            {% endif %}
+            <div class="card-body">
+
+            <p class="card-text">{{product.description}}</p>
+                <a href="#" class="btn btn-primary">Заказать</a>
+          </div>
+        </div>
+
+{% endblock%}

+ 88 - 0
project/app/templates/base.html

@@ -0,0 +1,88 @@
+{% load bootstrap5 %}
+{% bootstrap_css %}
+{% bootstrap_javascript %}
+{% load static %}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+</head>
+<body>
+    <nav class="navbar navbar-expand-lg bg-body-tertiary">
+  <div class="container-fluid">
+    <a class="navbar-brand" href="#">Site</a>
+    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
+      <span class="navbar-toggler-icon"></span>
+    </button>
+    <div class="collapse navbar-collapse" id="navbarSupportedContent">
+      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
+        <li class="nav-item">
+          <a class="nav-link active" aria-current="page" href="{% url 'base' %}">Главная страница</a>
+        </li>
+        <li class="nav-item">
+          <a class="nav-link" href="{% url 'service' %}">Услуги/товары</a>
+        </li>
+        <li class="nav-item dropdown ">
+          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
+            Пользователь
+          </a>
+          <ul class="dropdown-menu">
+            <li><a class="dropdown-item" href="{% url 'profile' %}">Личный кабинет</a></li>
+            <li><a class="dropdown-item" href="{% url 'register' %}">Регистрация</a></li>
+            <li><a class="dropdown-item" href="{% url 'login' %}">Вход</a></li>
+              <li><a class="dropdown-item" href="{% url 'log' %}">Выход</a></li>
+          </ul>
+        </li>
+        <form action="{% url 'search_result' %}" method="get">
+            <input name="q" type="search_result" type="text" placeholder="Поиск продуктов">
+            <button type="submit">Отправить</button>
+        </form>
+      </ul>
+    </div>
+  </div>
+
+
+
+</nav>
+{% block content%}
+{% if product %}
+    <div class="container">
+      <div class="row">
+        {% for pro in product %}
+          <div class="card d-flex justify-content-center " style="width: 20rem;">
+              <h5 class="card-title d-flex justify-content-center">{{pro.name}}</h5>
+              {% if pro.image %}
+                <img class="d-flex justify-content-center mx-auto " src="{{pro.image.url}}" width="280px" height="400px" ><br>
+            {% endif %}
+            <div class="card-body">
+            <p class="card-text">{{pro.description}}</p>
+            <a href="{% url 'prod_uct' pro.id %}" class="btn btn-primary"> О товаре</a>
+          </div>
+        </div>
+
+          {% endfor %}
+      </div>
+    </div>
+
+{% endif%}
+    <div class="pagination d-flex justify-content-center">
+    <span class="step-links">
+        {% if page_obj.has_previous %}
+            <a href="?page=1">&laquo; Назад</a>
+            <a href="?page={{ page_obj.previous_page_number }}">previous</a>
+        {% endif %}
+
+        <span class="current">
+            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
+        </span>
+
+        {% if page_obj.has_next %}
+            <a href="?page={{ page_obj.next_page_number }}"></a>
+            <a href="?page={{ page_obj.paginator.num_pages }}">Дальше &raquo;</a>
+        {% endif %}
+    </span>
+</div>
+{% endblock%}
+</body>
+</html>

+ 28 - 0
project/app/templates/profile.html

@@ -0,0 +1,28 @@
+{% extends 'base.html'%}
+{% block content%}
+<h2>Личный кабинет</h2>
+<div>Пользователь: {{user.username}}</div><br>
+Фамилия: {{user.lastname}}<br>
+Email: {{user.email}}<br>
+{% if user.foto %}
+    <img src="{{user.foto.url}}" width="200px" height="200px"><br><br>
+{% endif %}
+<h3>Заказанные товары</h3>
+ <div class="container">
+      <div class="row">
+        {% for pro in user.basket_set.all %}
+          <div class="card d-flex justify-content-center " style="width: 20rem;">
+              <h5 class="card-title d-flex justify-content-center">{{pro.product.name}}</h5>
+              {% if pro.product.image %}
+                <img class="d-flex justify-content-center mx-auto " src="{{pro.product.image.url}}" width="280px" height="400px" ><br>
+            {% endif %}
+            <div class="card-body">
+            <p class="card-text">{{pro.product.description}}</p>
+            <a href="{% url 'prod_uct' pro.id %}" class="btn btn-primary"> О товаре</a>
+          </div>
+        </div>
+
+          {% endfor %}
+      </div>
+    </div>
+{% endblock%}

+ 5 - 0
project/app/templates/registration/log.html

@@ -0,0 +1,5 @@
+{% extends 'base.html'%}
+{% block content%}
+<h3>Вы вышли</h3>
+<a class="dropdown-item btn btn-primary" href="{% url 'login' %}">Вход</a>
+{% endblock%}

+ 10 - 0
project/app/templates/registration/login.html

@@ -0,0 +1,10 @@
+{% extends 'base.html'%}
+{% block content%}
+<form method="post" >
+    <table>
+        {% csrf_token %}
+        {{ form.as_table }}
+    </table>
+    <input type="submit" value="Отправить" class="btn btn-primary">
+</form>
+{% endblock%}

+ 10 - 0
project/app/templates/registration/register.html

@@ -0,0 +1,10 @@
+{% extends 'base.html'%}
+{% block content%}
+<form method="post" enctype="multipart/form-data">
+    <table>
+        {% csrf_token %}
+        {{ form.as_table }}
+    </table>
+    <input type="submit" value="Отправить" class="btn btn-primary">
+</form>
+{% endblock%}

+ 19 - 0
project/app/templates/search.html

@@ -0,0 +1,19 @@
+{% extends 'base.html'%}
+{% load bootstrap5 %}
+{% block page %}
+    <h1>Поиск</h1>
+    {% if article_lists %}
+        {% for article in article_lists %}
+            <article>
+                <a href="{{ article.get_absolute_url }}">
+                    <h2>{{ article.article_title }}</h2>
+                </a>
+                {{ article.desctription|safe }}
+                <p><a class="btn btn-default btn-sm" href="{{ article.get_absolute_url }}">Читать далее</a></p>
+            </article>
+        {% endfor %}
+        {% bootstrap_pagination article_lists url=last_question %}
+    {% else %}
+        <p>Не найдено публикаций по вашему запросу<br>Попробуйте повторить запрос с другой формулировкой</p>
+    {% endif %}
+{% endblock %}

+ 20 - 0
project/app/templates/service.html

@@ -0,0 +1,20 @@
+{% extends 'base.html'%}
+{% block content%}
+{% if product %}
+    <div class="container">
+      <div class="row">
+        {% for pro in product%}
+        <div class="col-lg-4 col-sm-6 border">
+          <h3 class="d-flex justify-content-center ">{{pro.name}}</h3><br>
+          {% if pro.image %}
+            <img class="d-flex justify-content-center mx-auto " src="{{pro.image.url}}" width="350px" height="400px" ><br>
+          {% endif %}
+          {{pro.type}}<br>
+          <p class="d-inline-block text-truncate" style="max-width: 200px;">{{pro.description}}</p><br>
+          <a href="{% url 'prod_uct' pro.id %}" class="btn btn-primary" >О товаре</a>
+        </div>
+        {% endfor %}
+      </div>
+    </div>
+{% endif%}
+{% endblock%}

+ 3 - 0
project/app/tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 15 - 0
project/app/urls.py

@@ -0,0 +1,15 @@
+from django.conf import settings
+from django.conf.urls.static import static
+from django.urls import path, include
+from .views import *
+
+
+urlpatterns = [
+    path('', ProductList.as_view(), name='base'),
+    path('service/<int:pk>', ProductView.as_view(), name='prod_uct'),
+    path('service/', ProductListMax.as_view(), name='service'),
+    path('register/', RegistrationUserForm.as_view(), name='register'),
+    path('profile/', profile, name='profile'),
+    path('search_result/', Search.as_view(), name='search_result'),
+    path('log/', log, name='log'),
+]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

+ 68 - 0
project/app/views.py

@@ -0,0 +1,68 @@
+from django.shortcuts import render
+
+# Create your views here.
+from django.contrib.auth.mixins import LoginRequiredMixin
+from django.shortcuts import render, redirect
+from django.urls import reverse_lazy
+from django.views import generic
+from django.views.generic import CreateView, ListView
+from django.views.generic.detail import DetailView
+from .models import *
+from .forms import *
+
+
+
+
+
+class ProductList(generic.ListView):
+    model = Product
+    fields = ('name', 'description', 'type', 'image', 'date',)
+    template_name = 'base.html'
+    context_object_name = 'product'
+    paginate_by = 5
+
+
+class RegistrationUserForm(CreateView):
+    form_class = RegistrateForm
+    template_name = 'registration/register.html'
+    success_url = reverse_lazy('login')
+
+
+class ProductListMax(generic.ListView):
+    model = Product
+    fields = ('name', 'description', 'type', 'image', 'id')
+    template_name = 'service.html'
+    context_object_name = 'product'
+
+
+class ProductView(generic.DetailView):
+    model = Product
+    fields = ('name', 'description', 'type', 'image', 'user')
+    template_name = 'app/product_list.html'
+
+
+class BasketView(generic.DetailView):
+    model = Basket
+    template_name = 'cabinet.html'
+    context_object_name = 'basket'
+
+
+def profile(request):
+    return render(request, 'profile.html')
+
+
+class Search(ListView):
+    template_name = 'base.html'
+
+    def get_queryset(self):
+        return Product.objects.filter(name__icontains=self.request.GET.get('q'))
+
+    def get_context_data(self, *, object_list=None, **kwargs):
+        context = super().get_context_data(**kwargs)
+        context['q'] = self.request.GET.get
+
+def log(request):
+    return render(request,'registration/log.html')
+
+
+

BIN
project/db.sqlite3


+ 22 - 0
project/manage.py

@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+    """Run administrative tasks."""
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
+    try:
+        from django.core.management import execute_from_command_line
+    except ImportError as exc:
+        raise ImportError(
+            "Couldn't import Django. Are you sure it's installed and "
+            "available on your PYTHONPATH environment variable? Did you "
+            "forget to activate a virtual environment?"
+        ) from exc
+    execute_from_command_line(sys.argv)
+
+
+if __name__ == "__main__":
+    main()

BIN
project/media/media/изображение_2023-12-26_094806025.png


BIN
project/media/media/изображение_2023-12-26_095108453.png


BIN
project/media/media/изображение_2023-12-26_095112277.png


BIN
project/media/media/изображение_2023-12-26_095115805.png


BIN
project/media/media/изображение_2023-12-26_095119125.png


BIN
project/media/media/изображение_2023-12-26_095122189.png


BIN
project/media/media/изображение_2023-12-26_095126989.png


BIN
project/media/media/изображение_2023-12-26_102618180.png


+ 0 - 0
project/project/__init__.py


+ 16 - 0
project/project/asgi.py

@@ -0,0 +1,16 @@
+"""
+ASGI config for project project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
+
+application = get_asgi_application()

+ 133 - 0
project/project/settings.py

@@ -0,0 +1,133 @@
+"""
+Django settings for project project.
+
+Generated by 'django-admin startproject' using Django 5.0.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.0/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/5.0/ref/settings/
+"""
+
+from pathlib import Path
+import os.path
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = "django-insecure-sg5$b)6%8r&(veaf4r8oussdlrow$jzq9kn6kkt56w7#ny)@xc"
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+    "django.contrib.admin",
+    "django.contrib.auth",
+    "django.contrib.contenttypes",
+    "django.contrib.sessions",
+    "django.contrib.messages",
+    "django.contrib.staticfiles",
+    'app',
+    'bootstrap5',
+
+]
+
+MIDDLEWARE = [
+    "django.middleware.security.SecurityMiddleware",
+    "django.contrib.sessions.middleware.SessionMiddleware",
+    "django.middleware.common.CommonMiddleware",
+    "django.middleware.csrf.CsrfViewMiddleware",
+    "django.contrib.auth.middleware.AuthenticationMiddleware",
+    "django.contrib.messages.middleware.MessageMiddleware",
+    "django.middleware.clickjacking.XFrameOptionsMiddleware",
+]
+
+ROOT_URLCONF = "project.urls"
+
+TEMPLATES = [
+    {
+        "BACKEND": "django.template.backends.django.DjangoTemplates",
+        "DIRS": [os.path.join(BASE_DIR, 'templates')],
+        "APP_DIRS": True,
+        "OPTIONS": {
+            "context_processors": [
+                "django.template.context_processors.debug",
+                "django.template.context_processors.request",
+                "django.contrib.auth.context_processors.auth",
+                "django.contrib.messages.context_processors.messages",
+            ],
+        },
+    },
+]
+
+WSGI_APPLICATION = "project.wsgi.application"
+
+
+# Database
+# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
+
+DATABASES = {
+    "default": {
+        "ENGINE": "django.db.backends.sqlite3",
+        "NAME": BASE_DIR / "db.sqlite3",
+    }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+    {
+        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
+    },
+    {
+        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
+    },
+    {
+        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
+    },
+    {
+        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
+    },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/5.0/topics/i18n/
+
+LANGUAGE_CODE = "ru-ru"
+
+TIME_ZONE = "UTC"
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images
+# https://docs.djangoproject.com/en/5.0/howto/static-files/
+
+STATIC_URL = "static/"
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
+
+MEDIA_URL = 'media/'
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
+
+LOGIN_REDIRECT_URL = 'base'
+
+AUTH_USER_MODEL = 'app.AbUser'

+ 24 - 0
project/project/urls.py

@@ -0,0 +1,24 @@
+"""
+URL configuration for project project.
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+    https://docs.djangoproject.com/en/5.0/topics/http/urls/
+Examples:
+Function views
+    1. Add an import:  from my_app import views
+    2. Add a URL to urlpatterns:  path('', views.home, name='home')
+Class-based views
+    1. Add an import:  from other_app.views import Home
+    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
+Including another URLconf
+    1. Import the include() function: from django.urls import include, path
+    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path, include
+
+urlpatterns = [
+    path("admin/", admin.site.urls),
+    path("", include('django.contrib.auth.urls')),
+    path('', include('app.urls')),
+]

+ 16 - 0
project/project/wsgi.py

@@ -0,0 +1,16 @@
+"""
+WSGI config for project project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
+
+application = get_wsgi_application()