commit 050b6d80ea7275ee2e28d1656f3c6c66ea5e7d5f Author: root Date: Thu Sep 25 09:37:48 2025 +0300 init diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..f006bdc Binary files /dev/null and b/db.sqlite3 differ diff --git a/firstwebpage/__init__.py b/firstwebpage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/firstwebpage/__pycache__/__init__.cpython-310.pyc b/firstwebpage/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..3ae4b30 Binary files /dev/null and b/firstwebpage/__pycache__/__init__.cpython-310.pyc differ diff --git a/firstwebpage/__pycache__/settings.cpython-310.pyc b/firstwebpage/__pycache__/settings.cpython-310.pyc new file mode 100644 index 0000000..4df29ee Binary files /dev/null and b/firstwebpage/__pycache__/settings.cpython-310.pyc differ diff --git a/firstwebpage/__pycache__/urls.cpython-310.pyc b/firstwebpage/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000..573c58d Binary files /dev/null and b/firstwebpage/__pycache__/urls.cpython-310.pyc differ diff --git a/firstwebpage/__pycache__/wsgi.cpython-310.pyc b/firstwebpage/__pycache__/wsgi.cpython-310.pyc new file mode 100644 index 0000000..9d39b67 Binary files /dev/null and b/firstwebpage/__pycache__/wsgi.cpython-310.pyc differ diff --git a/firstwebpage/asgi.py b/firstwebpage/asgi.py new file mode 100644 index 0000000..668aa67 --- /dev/null +++ b/firstwebpage/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for firstwebpage 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.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'firstwebpage.settings') + +application = get_asgi_application() diff --git a/firstwebpage/settings.py b/firstwebpage/settings.py new file mode 100644 index 0000000..540b8b6 --- /dev/null +++ b/firstwebpage/settings.py @@ -0,0 +1,126 @@ +""" +Django settings for firstwebpage project. + +Generated by 'django-admin startproject' using Django 5.2.6. + +For more information on this file, see +https://docs.djangoproject.com/en/5.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.2/ref/settings/ +""" + +from pathlib import 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.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-xvqgs$b3!oujr0vh)-(b%*y5sq@q6n)hopgwv69$%^tun8d6(x' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ['94.250.253.128'] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +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 = 'firstwebpage.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'flatpages'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'firstwebpage.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.2/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.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.2/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +STATICFILES_DIRS = [ + BASE_DIR / 'flatpages/static', +] diff --git a/firstwebpage/urls.py b/firstwebpage/urls.py new file mode 100644 index 0000000..0f0a2d4 --- /dev/null +++ b/firstwebpage/urls.py @@ -0,0 +1,25 @@ +""" +URL configuration for firstwebpage project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.2/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 +from flatpages import views + +urlpatterns = [ + path('admin/', admin.site.urls), + path('hello/', views.hello, name='hello'), + path('', views.home, name='hello'), +] diff --git a/firstwebpage/wsgi.py b/firstwebpage/wsgi.py new file mode 100644 index 0000000..05c0f05 --- /dev/null +++ b/firstwebpage/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for firstwebpage 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.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'firstwebpage.settings') + +application = get_wsgi_application() diff --git a/flatpages/__init__.py b/flatpages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/flatpages/__pycache__/__init__.cpython-310.pyc b/flatpages/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..b90c95b Binary files /dev/null and b/flatpages/__pycache__/__init__.cpython-310.pyc differ diff --git a/flatpages/__pycache__/views.cpython-310.pyc b/flatpages/__pycache__/views.cpython-310.pyc new file mode 100644 index 0000000..140c6da Binary files /dev/null and b/flatpages/__pycache__/views.cpython-310.pyc differ diff --git a/flatpages/admin.py b/flatpages/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/flatpages/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/flatpages/apps.py b/flatpages/apps.py new file mode 100644 index 0000000..0e8248d --- /dev/null +++ b/flatpages/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class FlatpagesConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'flatpages' diff --git a/flatpages/migrations/__init__.py b/flatpages/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/flatpages/models.py b/flatpages/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/flatpages/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/flatpages/static/index.css b/flatpages/static/index.css new file mode 100644 index 0000000..84104c6 --- /dev/null +++ b/flatpages/static/index.css @@ -0,0 +1,29 @@ +body { + background: #1abc9c; + font-family: Tahoma, Arial, sans-serif; + color: #333; +} +table { + border-collapse: collapse; +} +p, h4 { + font-size: 20px; + margin-bottom: 0; +} +h4 { + font-size: 14px; +} +ul, ol { + margin: 0; +} +table tr td { + padding: 5px; +} +table { + width: 100%; +} + +img { + height: 30px; + width: auto; +} diff --git a/flatpages/templates/index.html b/flatpages/templates/index.html new file mode 100644 index 0000000..dfe2e84 --- /dev/null +++ b/flatpages/templates/index.html @@ -0,0 +1,72 @@ + + + + Привет, Мир! + + +

Привет, Мир!

+

Это учебный сайт, с его помощью будут изучены технологии + python/django, html/css.

+

Как видите, здесь используются заголовки различных + уровней.

+

Здесь есть маркированный список:

+

+ +

+

И нумерованный список:

+

+
    +
  1. Элемент 1;
  2. +
  3. элемент 2;
  4. +
  5. элемент 3;
  6. +
  7. последний элемент.
  8. +
+

+

И даже таблица:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Столбик 1Столбик 2Столбик 3Столбик 4
Строка 1 Столбец 1Строка 1 Столбец 2Строка 1 Столбец 3Строка 1 Столбец 4
Строка 2 Столбец 1Строка 2 Столбец 2Строка 2 Столбец 3Строка 2 Столбец 4
Строка 3 Столбец 1Строка 3 Столбец 2Строка 3 Столбец 3Строка 3 Столбец 4
Строка 4 Столбец 1Строка 4 Столбец 2Строка 4 Столбец 3Строка 4 Столбец 4
Строка 5 Столбец 1Строка 5 Столбец 2Строка 5 Столбец 3Строка 5 Столбец 4
+ + diff --git a/flatpages/templates/static_handler.html b/flatpages/templates/static_handler.html new file mode 100644 index 0000000..abce0b3 --- /dev/null +++ b/flatpages/templates/static_handler.html @@ -0,0 +1,100 @@ + + + + Привет, Мир! + {% load static %} + + + +

Привет, Мир!

+

Это учебный сайт, с его помощью будут изучены технологии + python/django, html/css.

+

Как видите, здесь используются заголовки различных + уровней.

+

Здесь есть маркированный список:

+

Маркированный список

+ +

И нумерованный список:

+

Нумерованный список

+
    +
  1. Элемент 1;
  2. +
  3. элемент 2;
  4. +
  5. элемент 3;
  6. +
  7. последний элемент.
  8. +
+

И даже таблица:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Столбик 1Столбик 2Столбик 3Столбик 4Столбик 5Столбик 6
Строка 1 Столбец 1Строка 1 Столбец 2Строка 1 Столбец 3Строка 1 Столбец 4Строка 1 Столбец 5Строка 1 Столбец 6
Строка 2 Столбец 1Строка 2 Столбец 2Строка 2 Столбец 3Строка 2 Столбец 4Строка 2 Столбец 5Строка 2 Столбец 6
Строка 3 Столбец 1Строка 3 Столбец 2Строка 3 Столбец 3Строка 3 Столбец 4Строка 3 Столбец 5Строка 3 Столбец 6
Строка 4 Столбец 1Строка 4 Столбец 2Строка 4 Столбец 3Строка 4 Столбец 4Строка 4 Столбец 5Строка 4 Столбец 6
Строка 5 Столбец 1Строка 5 Столбец 2Строка 5 Столбец 3Строка 5 Столбец 4Строка 5 Столбец 5Строка 5 Столбец 6
Строка 6 Столбец 1Строка 6 Столбец 2Строка 6 Столбец 3Строка 6 Столбец 4Строка 6 Столбец 5Строка 6 Столбец 6
Строка 7 Столбец 1Строка 7 Столбец 2Строка 7 Столбец 3Строка 7 Столбец 4Строка 7 Столбец 5Строка 7 Столбец 6
+ + diff --git a/flatpages/tests.py b/flatpages/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/flatpages/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/flatpages/views.py b/flatpages/views.py new file mode 100644 index 0000000..f9ef8c3 --- /dev/null +++ b/flatpages/views.py @@ -0,0 +1,12 @@ +from django.shortcuts import render +from django.http import HttpResponse +from django.shortcuts import render +from django import template + +# Create your views here. + +def hello(request): + return HttpResponse('Привет, Мир!') + +def home(request): + return render(request, 'templates/static_handler.html') \ No newline at end of file diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..bf62026 --- /dev/null +++ b/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', 'firstwebpage.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()