commit 0ac496386c04d955134a0a6a78644c2627bf74b6 Author: erjemin Date: Fri Jul 23 23:10:33 2021 +0300 work splash-screen diff --git a/README.md b/README.md new file mode 100644 index 0000000..66c3076 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Проект CADpoint.ru (Новости 3D-печати и Систем Автоматизированного Проектирования) + +[Инструкция по развертыванию на хостинге DreamHoast.com](deploy_to_dreamhost.md) \ No newline at end of file diff --git a/cadpoint/cadpoint/__init__.py b/cadpoint/cadpoint/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cadpoint/cadpoint/__pycache__/__init__.cpython-38.pyc b/cadpoint/cadpoint/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..e12ad80 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/__init__.cpython-38.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/__init__.cpython-39.pyc b/cadpoint/cadpoint/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..9c98980 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/__init__.cpython-39.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/my_secret.cpython-38.pyc b/cadpoint/cadpoint/__pycache__/my_secret.cpython-38.pyc new file mode 100644 index 0000000..cd9c618 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/my_secret.cpython-38.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/my_secret.cpython-39.pyc b/cadpoint/cadpoint/__pycache__/my_secret.cpython-39.pyc new file mode 100644 index 0000000..81fb446 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/my_secret.cpython-39.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/settings.cpython-38.pyc b/cadpoint/cadpoint/__pycache__/settings.cpython-38.pyc new file mode 100644 index 0000000..729da43 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/settings.cpython-38.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/settings.cpython-39.pyc b/cadpoint/cadpoint/__pycache__/settings.cpython-39.pyc new file mode 100644 index 0000000..5ba582d Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/settings.cpython-39.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/urls.cpython-38.pyc b/cadpoint/cadpoint/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..269bb72 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/urls.cpython-38.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/urls.cpython-39.pyc b/cadpoint/cadpoint/__pycache__/urls.cpython-39.pyc new file mode 100644 index 0000000..deb2146 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/urls.cpython-39.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/wsgi.cpython-38.pyc b/cadpoint/cadpoint/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000..f704e5f Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/wsgi.cpython-38.pyc differ diff --git a/cadpoint/cadpoint/__pycache__/wsgi.cpython-39.pyc b/cadpoint/cadpoint/__pycache__/wsgi.cpython-39.pyc new file mode 100644 index 0000000..a66d946 Binary files /dev/null and b/cadpoint/cadpoint/__pycache__/wsgi.cpython-39.pyc differ diff --git a/cadpoint/cadpoint/asgi.py b/cadpoint/cadpoint/asgi.py new file mode 100644 index 0000000..5c6522a --- /dev/null +++ b/cadpoint/cadpoint/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for cadpoint 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/3.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cadpoint.settings') + +application = get_asgi_application() diff --git a/cadpoint/cadpoint/settings.py b/cadpoint/cadpoint/settings.py new file mode 100644 index 0000000..1df7b37 --- /dev/null +++ b/cadpoint/cadpoint/settings.py @@ -0,0 +1,245 @@ +""" +Django settings for cadpoint project. + +Generated by 'django-admin startproject' using Django 3.2.5. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.2/ref/settings/ +""" + +from pathlib import Path +from cadpoint.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/3.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = MY_SECRET_KEY + +# SECURITY WARNING: don't run with debug turned on in production! +if socket.gethostname() == MY_HOST_HOME: + DEBUG = True +else: + # Все остальные хосты (подразумевается продакшн) + DEBUG = False + + +ALLOWED_HOSTS = [ + '127.0.0.1', + 'localhost', + '192.168.1.30', # разработка домашний + '10.10.5.6', # разработка офис + 'cadpoint.ru', # продакшн хостинг + 'www.cadpoint.ru', # продакшн хостинг +] + +######################################### +# Настройки сообщений об ошибках когда все упало и т.п. +ADMINS = ( + ('S.Erjemin', 'erjemin@gmail.com'), +) + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + # 'easy_thumbnails', + # 'filer.apps.FilerConfig', + # 'mptt.apps.MpttConfig', + # # 'ckeditor_uploader', + # 'ckeditor', + '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 = 'cadpoint.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 = 'cadpoint.wsgi.application' + +# Password validation +# https://docs.djangoproject.com/en/3.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/3.2/topics/i18n/ +LANGUAGE_CODE = 'ru-RU' # <--------- RUSSIAN +# TIME_ZONE = 'Etc/GMT+3' # +TIME_ZONE = 'Europe/Moscow' # +USE_I18N = True +USE_L10N = True +USE_TZ = True # учитывать часовой пояс +FIRST_DAY_OF_WEEK = 1 # неделя начинается с понедельника +DEFAULT_CHARSET = 'utf-8' + + +# настройки THUMBNAIL (батарейка по созданию превьюшек) +THUMBNAIL_HIGH_RESOLUTION = True # Для easy_thumbnails поддержки retina-дисплеев (MacBooks, iOS и т.п.) +THUMBNAIL_PROCESSORS = ( + 'easy_thumbnails.processors.colorspace', + 'easy_thumbnails.processors.autocrop', + #'easy_thumbnails.processors.scale_and_crop', + 'filer.thumbnail_processors.scale_and_crop_with_subject_location', + 'easy_thumbnails.processors.filters', +) +THUMBNAIL_ALIASES = { + '': { + 'x64': {'size': (64, 64), 'crop': True}, + 'x680': {'size': (680, 680), 'crop': True}, + 'x1140': {'size': (1140, 1140), 'crop': True}, + }, +} +THUMBNAIL_QUALITY = 85 +THUMBNAIL_TRANSPARENCY_EXTENSION = 'png' +THUMBNAIL_WIDGET_OPTIONS = {'size': (64, 64)} + + +CKEDITOR_UPLOAD_PATH = "uploads/" +CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/" +CKEDITOR_FILENAME_GENERATOR = 'utils.get_filename' +# конфигуратор ckeditor https://ckeditor.com/latest/samples/toolbarconfigurator/index.html#basic +CKEDITOR_CONFIGS = { + 'default': { + 'toolbar_mini': [ + {'name': 'document', 'items': ['Source', '-', ]}, + {'name': 'basicstyles', 'items': ['Bold', 'Italic', 'Underline', 'NumberedList', 'BulletedList', + 'Format', '-', 'RemoveFormat']}, + {'name': 'my_custom_tools', 'items': ['Preview', 'Maximize']}, + ], + 'toolbar': 'mini', # put selected toolbar config here + 'height': '110', + 'toolbarCanCollapse': True, + }, + 'fine': { + 'toolbar_fine': [ + {'name': 'document', 'items': ['Source', '-' ]}, + {'name': 'clipboard', 'items': ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']}, + {'name': 'basicstyles', + 'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']}, + {'name': 'my_custom_tools', 'items': ['Preview', 'Maximize']}, + '/', + {'name': 'paragraph', + 'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', + 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', 'Styles', 'Format', 'Iframe']}, + {'name': 'links', 'items': ['Link', 'Unlink', 'Anchor']}, + {'name': 'insert', 'items': ['Image', 'Table', 'HorizontalRule', 'SpecialChar']}, + ], + 'toolbar': 'fine', + # 'removeButtons': 'Save,NewPage,ExportPdf,Preview,Print,Templates,Find,Replace,SelectAll,Scayt,Form,' + # 'Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Format,' + # 'Font,FontSize,Maximize,ShowBlocks,About,Styles,Flash,Smiley,PageBreak,Iframe,BidiLtr,' + # 'BidiRtl,Language,JustifyBlock,JustifyRight,JustifyCenter,JustifyLeft,Indent,Outdent,' + # 'Strike,TextColor,BGColor, + 'toolbarCanCollapse': True, + # 'extraPlugins': 'filer', + # 'editor': [ + # {'name': 'filebrowserBrowseUrl', 'items': ''}, + # {'name': 'filebrowserUploadUrl', 'items': ''}, + # ], + }, +} + +FILER_SUBJECT_LOCATION_IMAGE_DEBUG = True +FILER_CANONICAL_URL = 'sharing/' + + +STATIC_URL = '/static/' +MEDIA_URL = '/media/' + +if DEBUG: # DEBUG: заменяем настройки прода, на настройки девопа + MEDIA_ROOT = MY_MEDIA_ROOT_DEV + # STATIC_ROOT = MY_STATIC_ROOT_DEV1 + STATICFILES_DIRS = [MY_STATIC_ROOT_DEV, ] + ######################################### + # настройки для почтового сервера + EMAIL_HOST = MY_EMAIL_HOST_DEV # SMTP server + EMAIL_PORT = MY_EMAIL_PORT_DEV # для SSL/https + EMAIL_HOST_USER = MY_EMAIL_HOST_USER_DEV # login or '' + EMAIL_HOST_PASSWORD = MY_EMAIL_HOST_PASSWORD_DEV # password + EMAIL_FROM = MY_EMAIL_FROM_DEV # мейл, от имени которого отправляются письма + DATABASES = { + 'default': { + 'ENGINE': "django.db.backends.mysql", + 'HOST': MY_DATABASE_HOST_DEV, # Set to "" for localhost. Not used with sqlite3. + 'PORT': MY_DATABASE_PORT_DEV, # Set to "" for default. Not used with sqlite3. + 'NAME': MY_DATABASE_NAME_DEV, # Not used with sqlite3. + 'USER': MY_DATABASE_USER_DEV, # Not used with sqlite3. + 'PASSWORD': MY_DATABASE_PASSWORD_DEV, # Not used with sqlite3. + # 'OPTIONS': { 'autocommit': True, } + } + } + +else: + MEDIA_ROOT = MY_MEDIA_ROOT_PROD + STATIC_ROOT = MY_STATIC_ROOT_PROD + # STATICFILES_DIRS = [MY_STATIC_ROOT_PROD1, ] + ######################################### + # настройки для почтового сервера + EMAIL_HOST = MY_EMAIL_HOST_PROD # SMTP server + EMAIL_PORT = MY_EMAIL_PORT_PROD # для SSL/https + EMAIL_HOST_USER = MY_EMAIL_HOST_USER_PROD # login or '' + EMAIL_HOST_PASSWORD = MY_EMAIL_HOST_PASSWORD_PROD # password + EMAIL_FROM = MY_EMAIL_FROM_PROD # мейл, от имени которого отправляются письма + DATABASES = { + 'default': { + 'ENGINE': "django.db.backends.mysql", + 'HOST': MY_DATABASE_HOST_PROD, # Set to "" for localhost. Not used with sqlite3. + 'PORT': MY_DATABASE_PORT_PROD, # Set to "" for default. Not used with sqlite3. + 'NAME': MY_DATABASE_NAME_PROD, # Not used with sqlite3. + 'USER': MY_DATABASE_USER_PROD, # Not used with sqlite3. + 'PASSWORD': MY_DATABASE_PASSWORD_PROD, # Not used with sqlite3. + # 'OPTIONS': { 'autocommit': True, } + } + } + + +# Default primary key field type +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/cadpoint/cadpoint/urls.py b/cadpoint/cadpoint/urls.py new file mode 100644 index 0000000..0bfc410 --- /dev/null +++ b/cadpoint/cadpoint/urls.py @@ -0,0 +1,35 @@ +"""cadpoint URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.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 django.conf.urls.static import static +from cadpoint import settings +from django.conf.urls import url, include +from web import views + + +urlpatterns = [ + path('admin/', admin.site.urls), + + url(r'^$', views.index), +] + +handler404 = 'web.views.handler404' +handler500 = 'web.views.handler500' + +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + diff --git a/cadpoint/cadpoint/wsgi.py b/cadpoint/cadpoint/wsgi.py new file mode 100644 index 0000000..9e1f3ed --- /dev/null +++ b/cadpoint/cadpoint/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for cadpoint 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/3.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cadpoint.settings') + +application = get_wsgi_application() diff --git a/cadpoint/manage.py b/cadpoint/manage.py new file mode 100644 index 0000000..7cd95cf --- /dev/null +++ b/cadpoint/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', 'cadpoint.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() diff --git a/cadpoint/mysqlclient-1.4.6-cp39-cp39-win_amd64.whl b/cadpoint/mysqlclient-1.4.6-cp39-cp39-win_amd64.whl new file mode 100644 index 0000000..6cd97a8 Binary files /dev/null and b/cadpoint/mysqlclient-1.4.6-cp39-cp39-win_amd64.whl differ diff --git a/cadpoint/requarement_dev_home.txt b/cadpoint/requarement_dev_home.txt new file mode 100644 index 0000000..1be284a --- /dev/null +++ b/cadpoint/requarement_dev_home.txt @@ -0,0 +1,5 @@ +asgiref==3.4.1 +Django==3.2.5 +mysqlclient @ file:///M:/cloud-mail.ru/PRJ/PRJ_CADpoint2/mysqlclient-1.4.6-cp39-cp39-win_amd64.whl +pytz==2021.1 +sqlparse==0.4.1 diff --git a/cadpoint/requarement_prod_dreamhost.txt b/cadpoint/requarement_prod_dreamhost.txt new file mode 100644 index 0000000..cd5dfca --- /dev/null +++ b/cadpoint/requarement_prod_dreamhost.txt @@ -0,0 +1,5 @@ +asgiref==3.4.1 +Django==3.2.5 +mysqlclient==2.0.3 +pytz==2021.1 +sqlparse==0.4.1 diff --git a/cadpoint/templates/404.html b/cadpoint/templates/404.html new file mode 100644 index 0000000..387837b --- /dev/null +++ b/cadpoint/templates/404.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + CADpoint.ru - http 404 error + + + + + + +
+
+
+ cadpoint.ru - http 404 error +
попробуйте начать просмотр сайта с главной страницы...
+
+
+
+ + \ No newline at end of file diff --git a/cadpoint/templates/500.html b/cadpoint/templates/500.html new file mode 100644 index 0000000..cb5197b --- /dev/null +++ b/cadpoint/templates/500.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + CADpoint.ru - http 500 error + + + + + + +
+
+
+ cadpoint.ru - http 500 error +
подождите, скоро все починят...
+
+
+
+ + \ No newline at end of file diff --git a/cadpoint/templates/base.jinja2 b/cadpoint/templates/base.jinja2 new file mode 100644 index 0000000..104e7b0 --- /dev/null +++ b/cadpoint/templates/base.jinja2 @@ -0,0 +1,43 @@ + +{% load static %} + + + + + + + + + + + + + + + + + + + CADPOINT.RU: {% block Title %}{% endblock %} + {% comment %} + {% endcomment %} + {% comment %}theme-color предоставляет браузерам цвет CSS для + настройки отображения страницы или окружающего пользовательского интерфейса.{% endcomment %} + + + + {% comment %} + {% endcomment %} + + + {% block META_OG %}{% endblock %} + +{% block BODY %} + {% block Top_CSS1 %}{% endblock %}{% block Top_CSS2 %}{% endblock %}{% block Top_CSS3 %}{% endblock %}{% include "blocks/header_nav.jinja2" %}{% block CONTENT %}{% endblock %} +{# {% include "blocks/footer.jinja2" %}#}{% if COOKIES %} + {% include "blocks/accept-cookies.jinja2" %}{% endif %} + + + {% block Top_JS1 %}{% endblock %}{% block Top_JS2 %}{% endblock %}{% block Top_JS3 %}{% endblock %} +{% endblock %} + \ No newline at end of file diff --git a/cadpoint/templates/blocks/accept-cookies.jinja2 b/cadpoint/templates/blocks/accept-cookies.jinja2 new file mode 100644 index 0000000..7c5c162 --- /dev/null +++ b/cadpoint/templates/blocks/accept-cookies.jinja2 @@ -0,0 +1,15 @@ + + +
+
+ Тут используют cookie и ведут сбор технических данных о посещениях, потому как без этого интернет-сайты вообще почти не работают… + +
+
+
\ No newline at end of file diff --git a/cadpoint/templates/blocks/header_nav.jinja2 b/cadpoint/templates/blocks/header_nav.jinja2 new file mode 100644 index 0000000..52ad978 --- /dev/null +++ b/cadpoint/templates/blocks/header_nav.jinja2 @@ -0,0 +1,24 @@ +{% load static %}{# #} + + + {# #}{% comment %} + +
+ +
+ {% endcomment %} \ No newline at end of file diff --git a/cadpoint/templates/index.jinja2 b/cadpoint/templates/index.jinja2 new file mode 100644 index 0000000..a11d817 --- /dev/null +++ b/cadpoint/templates/index.jinja2 @@ -0,0 +1,40 @@ +{% extends "base.jinja2" %}{% load static %} + +{% block META_OG %}{% comment %} РАЗМЕТКА Open Graph ДЛЯ СОЦ-СЕТЕЙ + подробности: https://habr.com/ru/company/macloud/blog/555082/{% endcomment %} + {% comment %} Уникальное название страницы. + Используется парсерами URL-адресов в социальных сетях, таких как Twitter или Facebook{% endcomment %} + {% comment %} Уникальное описание страницы. + Используется парсерами URL-адресов в социальных сетях, таких как Twitter или Facebook.{% endcomment %} + {% comment %} Изображение, отображаемое, когда вы + делитесь ссылкой на страницу в социальных сетях, приложениях чата или других сайтах, + которые очищают URL-адреса. + В идеале это должно быть квадратное изображение с важным содержанием, размещенным + в центре квадрата в прямоугольнике с соотношением сторон 2:1. Это гарантирует, + что изображение будет хорошо смотреться на карточках с изображениями прямоугольной + и квадратной формы.{% endcomment %} + {% comment %} + Описание изображения. + Не используйте этот метатег, если изображение носит чисто декоративный характер + и не содержит значимой информации. Программы чтения с экрана игнорируют + изображение, если мы предоставлен замещающий текст.{% endcomment %} + {% comment %} Естественный язык страницы.{% endcomment %} + {% comment %} Тип контента, которым вы делитесь, + например website, article, или video.movie{% endcomment %} + {% comment %} Канонический URL страницы. + Обязательное свойство для допустимых страниц Open Graph.{% endcomment %} + {% comment %} определяет, как будут выглядеть + карточки при публикации в Twitter. Есть два варианта для веб-сайтов: summary + и summary_large_image{% endcomment %}{% endblock %} + + +{% block Title %}Главная страница{% endblock %} +{% block Description %}ФГУП Российские сети вещания и оповещения: Строительство и эксплуатация разноуровневых систем оповещения{% endblock %} +{% block Keywords %}ФГУП РСВО, российские сети вещания и оповещения, системы оповещения{% endblock %} + +{% block CONTENT %} +









ЛЯ-ЛЯ

+{% endblock %} + +{% block Top_JS1 %}{% endblock %} diff --git a/cadpoint/templates/under_reconstruction.jinja2 b/cadpoint/templates/under_reconstruction.jinja2 new file mode 100644 index 0000000..94ff654 --- /dev/null +++ b/cadpoint/templates/under_reconstruction.jinja2 @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + CADpoint.ru - http 500 error + + + + + + +
+
+
+ cadpoint.ru - under reconstruction +
сайт cadpoint.ru реконструируется... подождите, скоро все вся станет не так как прежде...
+
+
+
+ + \ No newline at end of file diff --git a/cadpoint/web/__init__.py b/cadpoint/web/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cadpoint/web/__pycache__/__init__.cpython-38.pyc b/cadpoint/web/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..83f1c6a Binary files /dev/null and b/cadpoint/web/__pycache__/__init__.cpython-38.pyc differ diff --git a/cadpoint/web/__pycache__/__init__.cpython-39.pyc b/cadpoint/web/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..8f83224 Binary files /dev/null and b/cadpoint/web/__pycache__/__init__.cpython-39.pyc differ diff --git a/cadpoint/web/__pycache__/add_function.cpython-39.pyc b/cadpoint/web/__pycache__/add_function.cpython-39.pyc new file mode 100644 index 0000000..cabb7a9 Binary files /dev/null and b/cadpoint/web/__pycache__/add_function.cpython-39.pyc differ diff --git a/cadpoint/web/__pycache__/admin.cpython-38.pyc b/cadpoint/web/__pycache__/admin.cpython-38.pyc new file mode 100644 index 0000000..620a3ae Binary files /dev/null and b/cadpoint/web/__pycache__/admin.cpython-38.pyc differ diff --git a/cadpoint/web/__pycache__/admin.cpython-39.pyc b/cadpoint/web/__pycache__/admin.cpython-39.pyc new file mode 100644 index 0000000..a703912 Binary files /dev/null and b/cadpoint/web/__pycache__/admin.cpython-39.pyc differ diff --git a/cadpoint/web/__pycache__/apps.cpython-38.pyc b/cadpoint/web/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000..c78efef Binary files /dev/null and b/cadpoint/web/__pycache__/apps.cpython-38.pyc differ diff --git a/cadpoint/web/__pycache__/apps.cpython-39.pyc b/cadpoint/web/__pycache__/apps.cpython-39.pyc new file mode 100644 index 0000000..36791e8 Binary files /dev/null and b/cadpoint/web/__pycache__/apps.cpython-39.pyc differ diff --git a/cadpoint/web/__pycache__/models.cpython-38.pyc b/cadpoint/web/__pycache__/models.cpython-38.pyc new file mode 100644 index 0000000..fb9217c Binary files /dev/null and b/cadpoint/web/__pycache__/models.cpython-38.pyc differ diff --git a/cadpoint/web/__pycache__/models.cpython-39.pyc b/cadpoint/web/__pycache__/models.cpython-39.pyc new file mode 100644 index 0000000..5d5045d Binary files /dev/null and b/cadpoint/web/__pycache__/models.cpython-39.pyc differ diff --git a/cadpoint/web/__pycache__/views.cpython-39.pyc b/cadpoint/web/__pycache__/views.cpython-39.pyc new file mode 100644 index 0000000..43d5b78 Binary files /dev/null and b/cadpoint/web/__pycache__/views.cpython-39.pyc differ diff --git a/cadpoint/web/add_function.py b/cadpoint/web/add_function.py new file mode 100644 index 0000000..56a4553 --- /dev/null +++ b/cadpoint/web/add_function.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +from cadpoint.settings import * + + +def check_cookies(request) -> bool: + # проверка, что посетитель согласился со сбором данных через cookies + if request.COOKIES.get('cookie_accept'): + return False + return True diff --git a/cadpoint/web/admin.py b/cadpoint/web/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cadpoint/web/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cadpoint/web/apps.py b/cadpoint/web/apps.py new file mode 100644 index 0000000..682e923 --- /dev/null +++ b/cadpoint/web/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class WebConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'web' diff --git a/cadpoint/web/migrations/__init__.py b/cadpoint/web/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cadpoint/web/migrations/__pycache__/__init__.cpython-38.pyc b/cadpoint/web/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..72108fb Binary files /dev/null and b/cadpoint/web/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/cadpoint/web/migrations/__pycache__/__init__.cpython-39.pyc b/cadpoint/web/migrations/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..0f5e3d1 Binary files /dev/null and b/cadpoint/web/migrations/__pycache__/__init__.cpython-39.pyc differ diff --git a/cadpoint/web/models.py b/cadpoint/web/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cadpoint/web/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cadpoint/web/tests.py b/cadpoint/web/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cadpoint/web/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cadpoint/web/views.py b/cadpoint/web/views.py new file mode 100644 index 0000000..3087219 --- /dev/null +++ b/cadpoint/web/views.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +from django.shortcuts import render +from web.add_function import * + +# Create your views here. +def handler404(request, exception: str) -> render: + """ Обработчик ошибки 404 + + :param request: http-запрос + :param exception: сообщение с причиной ошибки + :return: response: http-ответ + """ + response = render(request, "404.html", {"MSG": exception}) + response.status_code = 404 + return response + + +def handler500(request) -> render: + """ Обработчик ошибки 500 + + :param request: + :return: response: + """ + response = render(request, "500.html", {}) + response.status_code = 500 + return response + + +def index(request) -> render: + """ Главная страница + + :param request: + :return: response: + """ + template = "index.jinja2" # шаблон + template = "under_reconstruction.jinja2" # шаблон + to_template = {"COOKIES": check_cookies(request)} + return render(request, template, to_template) diff --git a/deploy_to_dreamhost.md b/deploy_to_dreamhost.md new file mode 100644 index 0000000..a00a7e9 --- /dev/null +++ b/deploy_to_dreamhost.md @@ -0,0 +1,189 @@ +## Установка (компиляция) версии Python 3.8.6 + +Проект создан на версии Python 3.8.6. Скомпилируем необходимую версию Python. + +1. ВХОДИМ ЧЕРЗ SSH ЧЕРЕЗ LOGIN/PWD СВОЕГО АККАУНТА. +2. Создадим папку `tmp` (скорее всего уже создана) +3. Перейдем в эту папку +4. Скачаем tgz-архив с исходными файлами Python +5. Распакуем архив с помощью `tar` +6. Перейдем в папку `Python-3.8.6`, созданную при разархивации. +7. Сконфигурируем будущую компиляцию на размещение готовой версии Python в папку `~/opt/python-3.8.6` +8. Компилируем Python (в том числе будут запущены тесты) +9. Устанавливаем Python 3.8.6 + +``` +cd ~ +mkdir tmp +cd tmp +wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz +tar zxvf Python-3.8.6.tgz +cd Python-3.8.6 +./configure --prefix=$HOME/opt/python-3.8.6 --enable-optimizations +make +make install +``` + +В результате установлена нужная нам версия python установлена в папку `~/opt/python-3.8.6` (`/home//opt/python-3.8.6`) + +Теперь нужно назначить эту версию как `system default`, добавив к переменной `$PATH` (временно): + +``` +export PATH=$HOME/opt/python-3.8.6/bin:$PATH +``` + +------------------------------ +_Также можно добавить эту строку в файл `.bashrc` и/или `.bash_profile` в домашней директории `/home/.` Это нужно, чтобы сделать так, чтобы этот python всегда заменял версию которая есть на сервере._ + +------------------------------- + +Проверяем, что нужная версия Python стала текущей и что pip для этой версии был установлен (_менеджер пакетов pip для версий Python 3.x входит в поставку... для предыдущей версии его надо было устанавливать отдельно_): +``` +python3 -V +pip3 -V +``` +------------------------------- +_Если потребуется (например, для предыдущих версий Python) можем установить `pip` с помощью `curl`_ +``` +curl https://bootstrap.pypa.io/get-pip.py > ~/tmp/get-pip.py +python ~/tmp/get-pip.py +``` +------------------------------- + +## Настройка виртуального окружения проекта + +Чтобы "заморозить" установленную версию Python в виртуальном окружении `virtualenv`: + +``` +pip3 install virtualenv +``` + +Через панель управления хостингом __Domains -> Manage Domains -> Add Hosting to a Domain/Sub-Domain__ создадим поддомен __cadpoint.ru__ (без создания нового пользователя). В нашем домашнем каталоге будет создана папка `cadpoint.ru`. В этой папке будет лежать `passenger_wsgi.py`, также есть папка `public` в которой будут лежать статичные файлы не требующие обработки CGI (media, static и пр.) + +Теперь создадим виртуальное окружение в папке нашего сайта (`$HOME/cadpoint.ru`): +``` +virtualenv -p python3 $HOME/cadpoint.ru/env +``` + +Активируем созданное виртуальное окружение: +``` +source $HOME/cadpoint.ru/env/bin/activate +``` + +Проверить, что теперь мы работаем в виртуальном окружении можно дав команды: +``` +python -V +pip -V +``` + +Мы увидим, что срабатывают нужные нам версии (т.е. не надо использовать `python3` и `pip3`). + +## Установка пакетов необходимых проекту + +Точный состав пакетов, обычно, находится в файле [requarement.txt](dicquo/requarement.txt). Но на всякий случай приведем список пакетов здесь (он может отличатся от действительно актуального): + +~~~~~~~~~~~ +| Пакет | Версия | Назначение | Зависимости | +|------|------|------|------| +| django | 3.1.3 | Фреймворк Django | притащит с собой пакеты: __asgiref-3.3.0__, __pytz-2020.4__, __sqlparse-0.4.1__ +| django-taggit | 1.3.0 | Система тегов для Django | нет +| pillow | 8.0.1 | Пакет работы с графическими файлами +| pytils-safe | 0.3.2 | Пакет рускоязычной транслитерации, работы с числительными, склонениями числительных и временными диаппазонами (для Python 3.x) | нет +| typus | 0.2.2 | типограф | нет +| urllib3 | 1.25.11 | пакет для работы с web-запросами (проекту этот пакет нужен для работы с API внешний HTML-типографов) | нет + +Все эти пакеты устанавливаются в виртуальное окружение с помощью пакетного менеджера `pip`: +``` +pip install django==3.1.3 +pip install django-taggit==1.3.0 +pip install pillow==8.0.1 +pip install pytils-safe==0.3.2 +pip install typus==0.2.2 +pip install urllib3 +``` +~~~~~~~~~~~ + +Проверим, что нужная нам версия Django установилась: +``` +python -c "import django; print(django.get_version())" +``` + +## Копируем проект на хостинг + +На момент написания данной документации структура файлов и каталогов проекта в папке `cadpoint.ru` выглядела примерно так: +``` +. +|-- passenger_wsgi.py +|-- cadpoint +| |-- db.sqlite3 +| |-- manage.py +| |-- cadpoint +| | |-- __init__.py +| | |-- asgi.py +| | |-- my_secret.py +| | |-- settings.py +| | |-- urls.py +| | `-- wsgi.py +| |-- templates +| | |-- base.html +| | |-- blocks +| | | `-- tecnical_info.html +| | `-- index.html +| `-- web +|-- public +`-- tmp + `-- restart.txt +``` + +Далее нам надо скопировать статические файлы админки Django в папку статических файлов хостинга: +``` +cd ~/cadpoint.ru/dicquo +python manage.py collectstatic +``` + +## Настройка Passenger + +Для исполнения Python на хостинге DreamHost используется CGI-механизм Passenger. Чтобы его настроить для нашего проекта в папке сайта `~/cadpoint.ru` нужно разметить файл `passenger_wsgi.py` следующего содержания ([см. документацию DreamHost](https://help.dreamhost.com/hc/en-us/articles/360002341572-Creating-a-Django-project)): + +```python +#!/home//cadpoint.ru/env/bin/python3 + +import sys, os +INTERP = "/home//cadpoint.ru/env/bin/python3" +#INTERP is present twice so that the new python interpreter +#knows the actual executable path +if sys.executable != INTERP: + os.execl(INTERP, INTERP, *sys.argv) + +cwd = os.getcwd() +sys.path.append(cwd) +sys.path.append(cwd + '/cadpoint') #You must add your project here + +sys.path.insert(0,cwd+'/env/bin') +# sys.path.insert(0,cwd+'/env/lib/python3.8/site-packages/django') +sys.path.insert(0,cwd+'/env/lib/python3.8/site-packages') + +os.environ['DJANGO_SETTINGS_MODULE'] = "cadpoint.settings" +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() +``` + +После этого наш сайт должен зарабоать. + +Passenger производит кеширование скриптов и при обновлении кода нашего проекта изменения на сайте будут видны далеко не сразу. Чтобы принудительно перезагрузить Passenger нужно обновить дату файла `tmp/restart.txt` в папке нашего проекта ([см. документацию DreamHost](https://help.dreamhost.com/hc/en-us/articles/216385637-How-do-I-enable-Passenger-on-my-domain-)). + +Сначала создадим соответствующий каталог: +``` +cd ~/cadpoint.ru +mkdir -p tmp +``` + +Обновлять `restart.txt` можно командой: +``` +touch ~/cadpoint.ru/tmp/restart.txt +``` + +## Дополнительно + +Стоит включить ssl-сертификат для сайта. В панели управления DreamHost __Domains --> SSL/TLS Certificates__ + diff --git a/passenger_wsgi.py b/passenger_wsgi.py new file mode 100644 index 0000000..a1d3b7d --- /dev/null +++ b/passenger_wsgi.py @@ -0,0 +1,38 @@ +#!/home/eserg/cadpoint.ru/env/bin/python3 + +import sys, os +INTERP = "/home/eserg/cadpoint.ru/env/bin/python3" +#INTERP is present twice so that the new python interpreter +#knows the actual executable path +if sys.executable != INTERP: + os.execl(INTERP, INTERP, *sys.argv) + +cwd = os.getcwd() +sys.path.append(cwd) +sys.path.append(cwd + '/cadpoint') #You must add your project here + +sys.path.insert(0,cwd+'/env/bin') +# sys.path.insert(0,cwd+'/env/lib/python3.8/site-packages/django') +sys.path.insert(0,cwd+'/env/lib/python3.8/site-packages') + +os.environ['DJANGO_SETTINGS_MODULE'] = "cadpoint.settings" +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() + + +##!/usr/bin/env python +#import sys, os +#cwd = os.getcwd() +#sys.path.append(cwd) +#sys.path.append(cwd + '/dicquo') + +##Switch to new python +##if sys.version < "2.7.8": os.execl(cwd+"/env/bin/python", "python2.7", *sys.argv) + +#sys.path.insert(0,cwd+'/env/bin') +#sys.path.insert(0,cwd+'/env/lib/python3.8/site-packages/django') +#sys.path.insert(0,cwd+'/env/lib/python3.8/site-packages') + +#os.environ['DJANGO_SETTINGS_MODULE'] = "dicquo.settings" +#from django.core.wsgi import get_wsgi_application +#application = get_wsgi_application() diff --git a/public/favicon.gif b/public/favicon.gif new file mode 100644 index 0000000..e69de29 diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..39f958f Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..6c7cc50 Binary files /dev/null and b/public/favicon.png differ diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..ba5106d --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/public/googleacb673eb0c31969f.html b/public/googleacb673eb0c31969f.html new file mode 100644 index 0000000..be81982 --- /dev/null +++ b/public/googleacb673eb0c31969f.html @@ -0,0 +1 @@ +google-site-verification: googleacb673eb0c31969f.html \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..084cd33 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /admin/ diff --git a/public/static/css/cadpoint.css b/public/static/css/cadpoint.css new file mode 100644 index 0000000..2be4591 --- /dev/null +++ b/public/static/css/cadpoint.css @@ -0,0 +1,35 @@ +@charset "utf-8"; + +@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap'); + +body { font-family: 'Ubuntu', sans-serif; } + +h1, h2, h3, h4, h5, h6 {color: indigo} + +header > .navbar > .container > a.navbar-brand > img, +header.rastopiir > .container > a.navbar-brand > img { height: 42px; margin: 1ex 0; } +header > .navbar > .container > .navbar-nav > .nav-item > a { + font-size: 16px; line-height: 16px; + vertical-align: middle; + color: #008DD2; + text-decoration: none; + padding: 4px 1px; + margin: 0 20px; + display: inline-block; + border-bottom: solid 2px #008DD2; + transition: background-position 0.2s; + white-space: nowrap; +} +header > .navbar > .container > .navbar-nav > .nav-item > a:hover { + color: black; border-bottom: solid 2px black; transition: 0.8s; padding: 4px 15px; margin: 0 6px; +} +header > .navbar > .container > .navbar-nav > .nav-item > a:not(hover) { transition: 2.5s; } +header > .navbar > .container > .navbar-nav > .nav-item > form > .input-group > input { + border: solid 1px #008DD2; border-right: none; margin-left: 16px; + height: 31px; border-radius: 6px 0 0 6px; +} +header > .navbar > .container > .navbar-nav > .nav-item > form > .input-group > .input-group-append > button { + border: solid 1px #008DD2; border-left: none; background: none; + height: 31px; border-radius: 0 6px 6px 0; +} +header.rastopiir { height: 112px; z-index: 1; background: white; position: relative;} diff --git a/public/static/img/favicon.ico b/public/static/img/favicon.ico new file mode 100644 index 0000000..39f958f Binary files /dev/null and b/public/static/img/favicon.ico differ diff --git a/public/static/img/favicon.png b/public/static/img/favicon.png new file mode 100644 index 0000000..6c7cc50 Binary files /dev/null and b/public/static/img/favicon.png differ diff --git a/public/static/img/og-cadpoint-default.png b/public/static/img/og-cadpoint-default.png new file mode 100644 index 0000000..bfb044a Binary files /dev/null and b/public/static/img/og-cadpoint-default.png differ diff --git a/public/static/svgs/404-error.svg b/public/static/svgs/404-error.svg new file mode 100644 index 0000000..0aafe9b --- /dev/null +++ b/public/static/svgs/404-error.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/static/svgs/500-error.svg b/public/static/svgs/500-error.svg new file mode 100644 index 0000000..f3318e5 --- /dev/null +++ b/public/static/svgs/500-error.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/static/svgs/cappoint_under_reconstruction.svg b/public/static/svgs/cappoint_under_reconstruction.svg new file mode 100644 index 0000000..7b93abe --- /dev/null +++ b/public/static/svgs/cappoint_under_reconstruction.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/static/svgs/favicon.svg b/public/static/svgs/favicon.svg new file mode 100644 index 0000000..ba5106d --- /dev/null +++ b/public/static/svgs/favicon.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/public/static/svgs/logo_cadpoint-2021.svg b/public/static/svgs/logo_cadpoint-2021.svg new file mode 100644 index 0000000..d4b5fc1 --- /dev/null +++ b/public/static/svgs/logo_cadpoint-2021.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/static/svgs/search-ico.svg b/public/static/svgs/search-ico.svg new file mode 100644 index 0000000..ec041db --- /dev/null +++ b/public/static/svgs/search-ico.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/top.mail.ru-1612438.txt b/public/top.mail.ru-1612438.txt new file mode 100644 index 0000000..7de0aa5 --- /dev/null +++ b/public/top.mail.ru-1612438.txt @@ -0,0 +1 @@ +erjemin@gmail.com diff --git a/public/yandex_4387353ecb38e191.html b/public/yandex_4387353ecb38e191.html new file mode 100644 index 0000000..fd1abba --- /dev/null +++ b/public/yandex_4387353ecb38e191.html @@ -0,0 +1,6 @@ + + + + + Verification: 4387353ecb38e191 + \ No newline at end of file