init
This commit is contained in:
BIN
db.sqlite3
Normal file
BIN
db.sqlite3
Normal file
Binary file not shown.
0
firstwebpage/__init__.py
Normal file
0
firstwebpage/__init__.py
Normal file
BIN
firstwebpage/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
firstwebpage/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
firstwebpage/__pycache__/settings.cpython-310.pyc
Normal file
BIN
firstwebpage/__pycache__/settings.cpython-310.pyc
Normal file
Binary file not shown.
BIN
firstwebpage/__pycache__/urls.cpython-310.pyc
Normal file
BIN
firstwebpage/__pycache__/urls.cpython-310.pyc
Normal file
Binary file not shown.
BIN
firstwebpage/__pycache__/wsgi.cpython-310.pyc
Normal file
BIN
firstwebpage/__pycache__/wsgi.cpython-310.pyc
Normal file
Binary file not shown.
16
firstwebpage/asgi.py
Normal file
16
firstwebpage/asgi.py
Normal file
@@ -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()
|
||||
126
firstwebpage/settings.py
Normal file
126
firstwebpage/settings.py
Normal file
@@ -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',
|
||||
]
|
||||
25
firstwebpage/urls.py
Normal file
25
firstwebpage/urls.py
Normal file
@@ -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'),
|
||||
]
|
||||
16
firstwebpage/wsgi.py
Normal file
16
firstwebpage/wsgi.py
Normal file
@@ -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()
|
||||
0
flatpages/__init__.py
Normal file
0
flatpages/__init__.py
Normal file
BIN
flatpages/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
flatpages/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
flatpages/__pycache__/views.cpython-310.pyc
Normal file
BIN
flatpages/__pycache__/views.cpython-310.pyc
Normal file
Binary file not shown.
3
flatpages/admin.py
Normal file
3
flatpages/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
flatpages/apps.py
Normal file
6
flatpages/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class FlatpagesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'flatpages'
|
||||
0
flatpages/migrations/__init__.py
Normal file
0
flatpages/migrations/__init__.py
Normal file
3
flatpages/models.py
Normal file
3
flatpages/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
29
flatpages/static/index.css
Normal file
29
flatpages/static/index.css
Normal file
@@ -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;
|
||||
}
|
||||
72
flatpages/templates/index.html
Normal file
72
flatpages/templates/index.html
Normal file
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Привет, Мир!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Привет, Мир!</h1>
|
||||
<h2>Это учебный сайт, с его помощью будут изучены технологии
|
||||
python/django, html/css.</h2>
|
||||
<h3>Как видите, здесь используются заголовки различных
|
||||
уровней.</h3>
|
||||
<p>Здесь есть маркированный список:</p>
|
||||
<h4>
|
||||
<ul>
|
||||
<li>Элемент 1;</li>
|
||||
<li>элемент 2;</li>
|
||||
<li>элемент 3;</li>
|
||||
<li>последний элемент.</li>
|
||||
</ul>
|
||||
</h4>
|
||||
<p>И нумерованный список:</p>
|
||||
<h4>
|
||||
<ol>
|
||||
<li>Элемент 1;</li>
|
||||
<li>элемент 2;</li>
|
||||
<li>элемент 3;</li>
|
||||
<li>последний элемент.</li>
|
||||
</ol>
|
||||
</h4>
|
||||
<p>И даже таблица:</p>
|
||||
<table style="border: none">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Столбик 1</th>
|
||||
<th>Столбик 2</th>
|
||||
<th>Столбик 3</th>
|
||||
<th>Столбик 4</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>Строка 1 Столбец 1</td>
|
||||
<td>Строка 1 Столбец 2</td>
|
||||
<td>Строка 1 Столбец 3</td>
|
||||
<td>Строка 1 Столбец 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Строка 2 Столбец 1</td>
|
||||
<td>Строка 2 Столбец 2</td>
|
||||
<td>Строка 2 Столбец 3</td>
|
||||
<td>Строка 2 Столбец 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Строка 3 Столбец 1</td>
|
||||
<td>Строка 3 Столбец 2</td>
|
||||
<td>Строка 3 Столбец 3</td>
|
||||
<td>Строка 3 Столбец 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Строка 4 Столбец 1</td>
|
||||
<td>Строка 4 Столбец 2</td>
|
||||
<td>Строка 4 Столбец 3</td>
|
||||
<td>Строка 4 Столбец 4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Строка 5 Столбец 1</td>
|
||||
<td>Строка 5 Столбец 2</td>
|
||||
<td>Строка 5 Столбец 3</td>
|
||||
<td>Строка 5 Столбец 4</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
100
flatpages/templates/static_handler.html
Normal file
100
flatpages/templates/static_handler.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Привет, Мир!</title>
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'index.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Привет, Мир!</h1>
|
||||
<h2>Это учебный сайт, с его помощью будут изучены технологии
|
||||
python/django, html/css.</h2>
|
||||
<h3>Как видите, здесь используются заголовки различных
|
||||
уровней.</h3>
|
||||
<p>Здесь есть маркированный список:</p>
|
||||
<h4>Маркированный список</h4>
|
||||
<ul>
|
||||
<li>Элемент 1;</li>
|
||||
<li>элемент 2;</li>
|
||||
<li>элемент 3;</li>
|
||||
<li>последний элемент.</li>
|
||||
</ul>
|
||||
<p>И нумерованный список:</p>
|
||||
<h4>Нумерованный список</h4>
|
||||
<ol>
|
||||
<li>Элемент 1;</li>
|
||||
<li>элемент 2;</li>
|
||||
<li>элемент 3;</li>
|
||||
<li>последний элемент.</li>
|
||||
</ol>
|
||||
<p>И даже таблица:</p>
|
||||
<table style="border: 1px solid black; border-collapse: collapse;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="border: 1px solid black;">Столбик 1</th>
|
||||
<th style="border: 1px solid black;">Столбик 2</th>
|
||||
<th style="border: 1px solid black;">Столбик 3</th>
|
||||
<th style="border: 1px solid black;">Столбик 4</th>
|
||||
<th style="border: 1px solid black;">Столбик 5</th>
|
||||
<th style="border: 1px solid black;">Столбик 6</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 1 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 1 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 1 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 1 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 1 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 1 Столбец 6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 2 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 2 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 2 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 2 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 2 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 2 Столбец 6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 3 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 3 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 3 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 3 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 3 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 3 Столбец 6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 4 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 4 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 4 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 4 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 4 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 4 Столбец 6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 5 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 5 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 5 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 5 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 5 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 5 Столбец 6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 6 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 6 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 6 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 6 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 6 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 6 Столбец 6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Строка 7 Столбец 1</td>
|
||||
<td style="border: 1px solid black;">Строка 7 Столбец 2</td>
|
||||
<td style="border: 1px solid black;">Строка 7 Столбец 3</td>
|
||||
<td style="border: 1px solid black;">Строка 7 Столбец 4</td>
|
||||
<td style="border: 1px solid black;">Строка 7 Столбец 5</td>
|
||||
<td style="border: 1px solid black;">Строка 7 Столбец 6</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
3
flatpages/tests.py
Normal file
3
flatpages/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
12
flatpages/views.py
Normal file
12
flatpages/views.py
Normal file
@@ -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')
|
||||
22
manage.py
Executable file
22
manage.py
Executable file
@@ -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()
|
||||
Reference in New Issue
Block a user