Null project
This commit is contained in:
22
oknardia/manage.py
Executable file
22
oknardia/manage.py
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/home/e-serg/PRJ/ENV/oknardia_2022/bin/python
|
||||||
|
"""Утилита командной строки Django для административных задач."""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Запуск административных задач."""
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oknardia.settings')
|
||||||
|
try:
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
except ImportError as exc:
|
||||||
|
raise ImportError(
|
||||||
|
"Не удалось импортировать Django. Вы уверены, что он установлен "
|
||||||
|
"и доступен в вашей переменной окружения PYTHONPATH? "
|
||||||
|
"Вы не забыли активировать виртуальное окружение (virtual environment)?"
|
||||||
|
) from exc
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
0
oknardia/oknardia/__init__.py
Normal file
0
oknardia/oknardia/__init__.py
Normal file
16
oknardia/oknardia/asgi.py
Normal file
16
oknardia/oknardia/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
Конфигурация ASGI для проекта oknardia.
|
||||||
|
|
||||||
|
Он предоставляет вызываемый ASGI как переменную уровня модуля с именем «application».
|
||||||
|
|
||||||
|
Дополнительные сведения об этом файле см.
|
||||||
|
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oknardia.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
||||||
125
oknardia/oknardia/settings.py
Normal file
125
oknardia/oknardia/settings.py
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
"""
|
||||||
|
Django settings for oknardia project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 4.1.1.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/4.1/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/4.1/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from oknardia.my_secret import *
|
||||||
|
import socket
|
||||||
|
|
||||||
|
# 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/4.1/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-pd&1$j6z*1w#(j*16b+(@@#&2)+@x^^ot4)zqt-e67*1+$^qch'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
# ПРЕДУПРЕЖДЕНИЕ БЕЗОПАСНОСТИ: не работайте в режиме DEBUG в продашене!
|
||||||
|
if socket.gethostname() in MY_HOST_DEV:
|
||||||
|
DEBUG = True
|
||||||
|
else:
|
||||||
|
# Все остальные хосты (подразумевается продакшн)
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = MY_ALLOWED_HOSTS
|
||||||
|
|
||||||
|
# Настройки сообщений об ошибках когда все упало и т.п.
|
||||||
|
ADMINS = MY_ADMINS
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'web.apps.WebConfig',
|
||||||
|
]
|
||||||
|
|
||||||
|
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 = 'oknardia.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [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 = 'oknardia.wsgi.application'
|
||||||
|
|
||||||
|
# Валидаторы Password
|
||||||
|
# https://docs.djangoproject.com/en/4.1/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/4.1/topics/i18n/
|
||||||
|
LANGUAGE_CODE = 'ru-RU'
|
||||||
|
TIME_ZONE = 'Europe/Moscow'
|
||||||
|
USE_I18N = True
|
||||||
|
USE_TZ = True
|
||||||
|
USE_L10N = False # локальный формат дат имеет приоритет
|
||||||
|
FIRST_DAY_OF_WEEK = 1 # 1'st day week -- monday
|
||||||
|
SHORT_DATE_FORMAT = '%Y-%m-%d'
|
||||||
|
SHORT_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
|
||||||
|
|
||||||
|
# Статические файлы (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
MEDIA_URL = 'media/'
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
21
oknardia/oknardia/urls.py
Normal file
21
oknardia/oknardia/urls.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"""oknardia Конфигурация URL
|
||||||
|
|
||||||
|
Список `urlpatterns` направляет URL-адреса в представления. Дополнительную информацию см.:
|
||||||
|
https://docs.djangoproject.com/en/4.1/topics/http/urls/
|
||||||
|
Примеры:
|
||||||
|
Представления функций
|
||||||
|
1. Добавьте import: из представлений импорта my_app
|
||||||
|
2. Добавьте URL-адрес в urlpatterns: path('', views.home, name='home')
|
||||||
|
Представления на основе классов
|
||||||
|
1. Добавьте импорт: from other_app.views import Home
|
||||||
|
2. Добавьте URL-адрес в шаблоны URL-адресов: path('', Home.as_view(), name='home')
|
||||||
|
Включение другой конфигурации URL
|
||||||
|
1. Импортируйте функцию include(): из django.urls import include, path
|
||||||
|
2. Добавьте URL-адрес в urlpatterns: path('blog/', include('blog.urls'))
|
||||||
|
"""
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
]
|
||||||
16
oknardia/oknardia/wsgi.py
Normal file
16
oknardia/oknardia/wsgi.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
Конфигурация WSGI для проекта oknardia.
|
||||||
|
|
||||||
|
Он предоставляет вызываемый WSGI как переменную уровня модуля с именем «application».
|
||||||
|
|
||||||
|
Дополнительные сведения об этом файле см.
|
||||||
|
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oknardia.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
||||||
0
oknardia/web/__init__.py
Normal file
0
oknardia/web/__init__.py
Normal file
3
oknardia/web/admin.py
Normal file
3
oknardia/web/admin.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
6
oknardia/web/apps.py
Normal file
6
oknardia/web/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class WebConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'web'
|
||||||
3
oknardia/web/models.py
Normal file
3
oknardia/web/models.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
3
oknardia/web/tests.py
Normal file
3
oknardia/web/tests.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
3
oknardia/web/views.py
Normal file
3
oknardia/web/views.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
Reference in New Issue
Block a user