Загрузка данных
urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('main.urls')),
]
main/urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='home'),
path('contacts/', views.contacts, name='contacts'),
]
main/views.py:
from django.shortcuts import render
def index(request):
return render(request, 'main/index.html')
def contacts(request):
return render(request, 'main/contacts.html')
base.html:
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>
{% load static %}
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{% static 'main/css/style.css' %}">
</head>
<body>
<header>
<nav class="navbar">
<div class="logo">{% block logo %}{% endblock %}</div>
<ul class="nav-links">
<li><a href="{% url 'home' %}" class="nav-btn">Главная</a></li>
<li><a href="{% url 'contacts' %}" class="nav-btn">Контакты</a></li>
</ul>
</nav>
</header>
<main class="content">{% block content %}{% endblock %}</main>
<footer class="footer"><p>© 2026 Мой индивидуальный проект</p></footer>
</body>
</html>
index.html :
{% extends 'main/base.html' %}
{% load static %}
{% block content %}
<!--Сюда вставь свой текст-->
{# Пример содержимого: выбери ОДИН вариант и оставь его #}
{# Для Геймера #}
<!--
<h1>База данных моей вселенной</h1>
<p>Тут будет описание героев и их способностей.</p>
-->
{# Для Профи #}
<!--
<h1>Добро пожаловать в моё портфолио!</h1>
<p>Здесь я храню свои лучшие проекты на Python.</p>
-->
{# Для Витрины #}
<!--
<h1>Каталог эксклюзивных товаров</h1>
<p>Выбирай лучшее из моей коллекции.</p>
-->
{% endblock %}
style.css:
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Montserrat', sans-serif; }
body { display: flex; flex-direction: column; }
.content { flex: 1 0 auto; padding: 40px 20px; max-width: 1200px; margin: 0 auto; width: 100%; }
.footer { flex-shrink: 0; background: #222; color: white; text-align: center; padding: 20px; }
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 15px 50px; }
.nav-links { display: flex; list-style: none; gap: 20px; }
Геймер:
body { background: #0f0c29; color: #00ffcc; }
.navbar { background: #1b1b1b; border-bottom: 2px solid #00ffcc; }
.nav-btn {
color: #00ffcc;
border: 1px solid #00ffcc;
padding: 8px 15px;
text-decoration: none;
border-radius: 5px;
transition: 0.3s;
}
.nav-btn:hover {
background: #00ffcc;
color: #000;
box-shadow: 0 0 15px #00ffcc;
transform: scale(1.1); /* Кнопка увеличивается и светится */
}
Профи:
body { background: #fdfdfd; color: #2c3e50; }
.navbar {
background: #fff;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.nav-btn {
color: #2c3e50;
text-decoration: none;
padding: 8px 15px;
border-radius: 20px;
transition: 0.3s;
}
.nav-btn:hover {
background: #2c3e50;
color: #fff;
transform: translateY(-3px); /* Кнопка подпрыгивает */
}
Витрина:
body { background: #fff5e6; color: #444; }
.navbar {
background: #ff9f43;
color: white;
}
.nav-btn {
color: white;
text-decoration: none;
border-bottom: 2px solid transparent;
transition: 0.3s;
font-weight: bold;
}
.nav-btn:hover {
border-bottom: 2px solid white;
letter-spacing: 1px; /* Текст кнопки плавно растягивается */
}