| Server IP : 82.148.16.210 / Your IP : 216.73.216.19 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : root ( 0) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/projects/env1/src/project/ |
Upload File : |
from datetime import datetime, timezone, date
from pathlib import Path
from django.contrib.messages import constants as message_constants
from django.urls import reverse
from prometheus_client import Counter
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = '^6u$-uj2^g*%a9%91g3f&5h+vaqr37li+fg+o($mb23jl+rrfy'
DEBUG = False
PRODUCTION = True # First used in base.html template for Yandex.Metrika
ENABLE_HTML_MINIFY = True
DEBUG_PANEL = False
# print(str(BUILD_LAST_COMMIT).split(' ', 1)[0])
BUILD_VERSION = str(date.today() - date(2021, 6, 14)).split(' ', 1)[0] # Change this manually.
# This may be the number of days after last version (last commit)
# https://www.timeanddate.com/date/durationresult.html?d1=17&m1=12&y1=2020&d2=01&m2=06&y2=2021
BUILD_TAG = 'beta' # alpha, beta, release
BUILD_DATE_TAG = datetime.now(timezone.utc).strftime("%y%m")[1:]
VERSION = f'v.1.{BUILD_DATE_TAG} build {BUILD_VERSION} ({BUILD_TAG})'
print(f'{VERSION=}')
SITE_ID = 1
# Sometimes an error occur when enabled DEBUG_TOOLBAR (= True)
# AttributeError: 'ImageFieldFile' object has no attribute 'endswith'
DEBUG_TOOLBAR = False
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
if DEBUG:
MESSAGE_LEVEL = message_constants.DEBUG
ALLOWED_HOSTS = [
'*',
'127.0.0.1',
'zhriza.ru',
'www.zhriza.ru',
'142.93.160.197'
]
INTERNAL_IPS = [
'127.0.0.1'
]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'solo.apps.SoloAppConfig',
'adminsortable2',
'view_breadcrumbs',
'widget_tweaks',
'ckeditor',
'ckeditor_uploader',
# 'ckeditor_filebrowser_filer',
'django_dramatiq',
'filer',
'easy_thumbnails',
'django_summernote',
# django-health-check
'health_check', # required
'health_check.db', # stock Django health checkers
'health_check.cache',
'health_check.contrib.celery', # requires celery
'django_prometheus',
'allauth',
'allauth.account',
'allauth.socialaccount',
# # ... include the providers you want to enable:
# # 'allauth.socialaccount.providers.agave',
# # 'allauth.socialaccount.providers.amazon',
# # 'allauth.socialaccount.providers.amazon_cognito',
# # 'allauth.socialaccount.providers.angellist',
# 'allauth.socialaccount.providers.apple',
# # 'allauth.socialaccount.providers.asana',
# # 'allauth.socialaccount.providers.auth0',
# # 'allauth.socialaccount.providers.authentiq',
# # 'allauth.socialaccount.providers.azure',
# # 'allauth.socialaccount.providers.baidu',
# # 'allauth.socialaccount.providers.basecamp',
# # 'allauth.socialaccount.providers.battlenet',
# # 'allauth.socialaccount.providers.bitbucket',
# # 'allauth.socialaccount.providers.bitbucket_oauth2',
# # 'allauth.socialaccount.providers.bitly',
# # 'allauth.socialaccount.providers.box',
# # 'allauth.socialaccount.providers.cern',
# # 'allauth.socialaccount.providers.coinbase',
# # 'allauth.socialaccount.providers.dataporten',
# # 'allauth.socialaccount.providers.daum',
# # 'allauth.socialaccount.providers.digitalocean',
# # 'allauth.socialaccount.providers.discord',
# # 'allauth.socialaccount.providers.disqus',
# # 'allauth.socialaccount.providers.douban',
# # 'allauth.socialaccount.providers.doximity',
# # 'allauth.socialaccount.providers.draugiem',
# # 'allauth.socialaccount.providers.dropbox',
# # 'allauth.socialaccount.providers.dwolla',
# # 'allauth.socialaccount.providers.edmodo',
# # 'allauth.socialaccount.providers.edx',
# # 'allauth.socialaccount.providers.eventbrite',
# # 'allauth.socialaccount.providers.eveonline',
# # 'allauth.socialaccount.providers.evernote',
# # 'allauth.socialaccount.providers.exist',
# 'allauth.socialaccount.providers.facebook',
# # 'allauth.socialaccount.providers.feedly',
# # 'allauth.socialaccount.providers.figma',
# # 'allauth.socialaccount.providers.fivehundredpx',
# # 'allauth.socialaccount.providers.flickr',
# # 'allauth.socialaccount.providers.foursquare',
# # 'allauth.socialaccount.providers.fxa',
# # 'allauth.socialaccount.providers.github',
# # 'allauth.socialaccount.providers.gitlab',
# # 'allauth.socialaccount.providers.globus',
# 'allauth.socialaccount.providers.google',
# # 'allauth.socialaccount.providers.hubic',
# 'allauth.socialaccount.providers.instagram',
# # 'allauth.socialaccount.providers.jupyterhub',
# # 'allauth.socialaccount.providers.kakao',
# # 'allauth.socialaccount.providers.keycloak',
# # 'allauth.socialaccount.providers.line',
# # 'allauth.socialaccount.providers.linkedin',
# # 'allauth.socialaccount.providers.linkedin_oauth2',
# # 'allauth.socialaccount.providers.mailchimp',
# 'allauth.socialaccount.providers.mailru',
# # 'allauth.socialaccount.providers.meetup',
# # 'allauth.socialaccount.providers.microsoft',
# # 'allauth.socialaccount.providers.naver',
# # 'allauth.socialaccount.providers.nextcloud',
# 'allauth.socialaccount.providers.odnoklassniki',
# # 'allauth.socialaccount.providers.openid',
# # 'allauth.socialaccount.providers.openstreetmap',
# # 'allauth.socialaccount.providers.orcid',
# # 'allauth.socialaccount.providers.patreon',
# # 'allauth.socialaccount.providers.paypal',
# # 'allauth.socialaccount.providers.persona',
# # 'allauth.socialaccount.providers.pinterest',
# # 'allauth.socialaccount.providers.quickbooks',
# # 'allauth.socialaccount.providers.reddit',
# # 'allauth.socialaccount.providers.robinhood',
# # 'allauth.socialaccount.providers.salesforce',
# # 'allauth.socialaccount.providers.sharefile',
# # 'allauth.socialaccount.providers.shopify',
# # 'allauth.socialaccount.providers.slack',
# # 'allauth.socialaccount.providers.soundcloud',
# # 'allauth.socialaccount.providers.spotify',
# # 'allauth.socialaccount.providers.stackexchange',
# # 'allauth.socialaccount.providers.steam',
# # 'allauth.socialaccount.providers.stocktwits',
# # 'allauth.socialaccount.providers.strava',
# # 'allauth.socialaccount.providers.stripe',
# 'allauth.socialaccount.providers.telegram',
# # 'allauth.socialaccount.providers.trello',
# # 'allauth.socialaccount.providers.tumblr',
# # 'allauth.socialaccount.providers.twentythreeandme',
# # 'allauth.socialaccount.providers.twitch',
# 'allauth.socialaccount.providers.twitter',
# # 'allauth.socialaccount.providers.untappd',
# # 'allauth.socialaccount.providers.vimeo',
# # 'allauth.socialaccount.providers.vimeo_oauth2',
# 'allauth.socialaccount.providers.vk',
# # 'allauth.socialaccount.providers.weibo',
# # 'allauth.socialaccount.providers.weixin',
# # 'allauth.socialaccount.providers.windowslive',
# # 'allauth.socialaccount.providers.xing',
# # 'allauth.socialaccount.providers.yahoo',
# 'allauth.socialaccount.providers.yandex',
# # 'allauth.socialaccount.providers.ynab',
# # 'allauth.socialaccount.providers.zoho',
# # 'allauth.socialaccount.providers.zoom',
# # 'allauth.socialaccount.providers.okta',
'apps.employee.apps.EmployeeConfig',
'apps.homepage.apps.HomepageConfig',
'apps.user_profile.apps.UserProfileConfig',
'apps.accounts.apps.AccountsConfig',
'apps.newsletter.apps.NewsletterConfig',
'apps.feedback.apps.FeedbackConfig',
'apps.search.apps.SearchConfig',
'apps.blog.apps.BlogConfig',
'apps.pages.apps.PagesConfig',
'apps.dashboard.apps.DashboardConfig',
# 'apps.finance.apps.FinanceConfig',
'apps.finances.apps.FinancesConfig',
'apps.menu.apps.MenuConfig',
'apps.settings.apps.SettingsConfig',
#'django_gravatar',
#'apps.xmpp.apps.XMPPConfig',
]
# Development
if DEBUG:
if DEBUG_TOOLBAR:
INSTALLED_APPS += [
'debug_toolbar',
# django-debug-toolbar-template-timings
'template_timings_panel',
]
INSTALLED_APPS += [
'django_extensions',
]
MIDDLEWARE = []
MIDDLEWARE += [
'django.middleware.gzip.GZipMiddleware'
]
if DEBUG_TOOLBAR:
MIDDLEWARE += [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
MIDDLEWARE += [
# django_prometheus
'django_prometheus.middleware.PrometheusBeforeMiddleware',
# dev
#'debug_toolbar.middleware.DebugToolbarMiddleware',
# django-htmlmin
'htmlmin.middleware.HtmlMinifyMiddleware',
'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',
# 'htmlmin.middleware.HtmlMinifyMiddleware', # django-htmlmin
# 'htmlmin.middleware.MarkRequestMiddleware', # django-htmlmin
# django-crud
'crum.CurrentRequestUserMiddleware',
# django-htmlmin
'htmlmin.middleware.MarkRequestMiddleware',
# django_prometheus
'django_prometheus.middleware.PrometheusAfterMiddleware',
]
ROOT_URLCONF = 'project.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',
'apps.feedback.context_processors.email_to',
'apps.settings.context_processors.load_settings',
'project.context_processors.production',
'apps.dashboard.context_processors.dashboard_context',
],
},
},
]
WSGI_APPLICATION = 'project.wsgi.application'
# DATABASE_ROUTERS = ['postgresql',]
DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# },
# 'postgresql': {
'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'ENGINE': 'django_prometheus.db.backends.postgresql',
'NAME': 'db_zhriza',
'USER': 'zhriza_user',
'PASSWORD': 'oC4dB9gL5tC2dN6e',
'HOST': '127.0.0.1',
'PORT': '5432',
'ATOMIC_REQUESTS': True,
}
}
# Postgresql Backup Command
# Backup
# /usr/bin/pg_dump --file "/var/lib/pgadmin/storage/pga_user_891rpm_gmail.com/backup_db_zhriza_20210610" --host "127.0.0.1" --port "5432" --username "zhriza_user" --no-password --verbose --format=t --blobs --encoding "UTF8" --schema "public" "db_zhriza"
# su - postgres
# pg_dump -h 127.0.0.1 -p 5432 -U zhriza_user -W -F t db_zhriza > backup_db_zhriza_20210729.gz
# Restore
# /usr/bin/pg_restore --host "127.0.0.1" --port "5432" --username "zhriza_user" --no-password --role "zhriza_user" --dbname "db_zhriza" --verbose --schema "public" "/var/lib/pgadmin/storage/pga_user_891rpm_gmail.com/backup_db_zhriza_20210610"
# pg_restore
AUTH_PASSWORD_VALIDATORS = [
# {
# 'NAME': 'django.contrib.authorization.password_validation.UserAttributeSimilarityValidator',
# },
# {
# 'NAME': 'django.contrib.authorization.password_validation.MinimumLengthValidator',
# },
# {
# 'NAME': 'django.contrib.authorization.password_validation.CommonPasswordValidator',
# },
# {
# 'NAME': 'django.contrib.authorization.password_validation.NumericPasswordValidator',
# },
]
LANGUAGE_CODE = 'ru-ru'
TIME_ZONE = 'Europe/Moscow'
USE_I18N = True
USE_L10N = True
USE_TZ = True
DATETIME_FORMAT="%Y-%m-%dT%H:%M:%S"
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
STATICFILES_DIRS = (
BASE_DIR / 'static_files/',
BASE_DIR / 'media/',
)
# DEFAULT_FROM_EMAIL = 'info@zhriza.ru'
# EMAIL_HOST = 'smtp.yandex.ru'
# EMAIL_HOST_USER = 'info@zhriza.ru'
# EMAIL_HOST_PASSWORD = '278364926734'
# EMAIL_USE_TLS = True
# EMAIL_PORT = '587'
# django.core.mail
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.yandex.ru'
EMAIL_HOST_USER = 'robot@zhriza.ru'
EMAIL_HOST_PASSWORD = 'sA4sI4qY1oO3dQ1b'
EMAIL_PORT = 465
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
SEND_BROKEN_LINK_EMAILS = True
DEFAULT_FROM_EMAIL = 'robot@zhriza.ru'
SERVER_EMAIL = '891rpm@gmail.com'
ADMINS = [
("root", "891rpm@gmail.com"),
("zottau", "zottau@gmail.com")
]
# Информационный отдел «Жрица»
# info@zhriza.ru
#
# Общий отдел помощи «Жрица»
# help@zhriza.ru
#
# Партнёрский отдел «Жрица»
# resale@zhriza.ru
#
# Техподдержка «Жрица»
# support@zhriza.ru
#
# Финансовый отдел «Жрица»
# finance@zhriza.ru
#
# Рекламный отдел «Жрица»
# ads@zhriza.ru
CRISPY_TEMPLATE_PACK = 'bootstrap4'
# Project vars
PROJECT_MANAGER_EMAIL_TO = 'info@zhriza.ru'
# PAGE_LIMIT = 5
HOMEPAGE_PAGE_LIMIT = 10
AUTH_USER_MODEL = 'auth.User'
# ABSOLUTE_URL_OVERRIDES = {
# 'dashboard.users.users.create': lambda o: "/dashboard/users/users/create/%s/" % o.pk,
# }
ABSOLUTE_URL_OVERRIDES = {
'auth.user': lambda u: "/users/%s/" % u.username,
}
# LOGIN_URL = '/login/'
LOGIN_URL = 'account_login'
LOGIN_REDIRECT_URL = '/dashboard/' # '/profile/'
# django-allauth
# ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS=True
# ACCOUNT_AUTHENTICATION_METHOD (=”username” | “email” | “username_email”)
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
# This disabled 'username' field
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_SUBJECT_PREFIX = "[ZHRIZA.RU] "
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
ACCOUNT_USERNAME_MIN_LENGTH = 5
ACCOUNT_FORMS = {
# 'signup': 'allauth.account.forms.SignupForm'
'signup': 'apps.accounts.forms.MySignupForm'
}
# SOCIALACCOUNT_AUTO_SIGNUP=True
# ACCOUNT_LOGOUT_ON_GET = True
AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
]
SOCIALACCOUNT_PROVIDERS = {
# 'google': {
# # For each OAuth based provider, either add a ``SocialApp``
# # (``socialaccount`` app) containing the required client
# # credentials, or list them here:
# # 'APP': {
# # 'client_id': '123',
# # 'secret': '456',
# # 'key': ''
# # }
# }
}
# DEPRECATED at 2021.04.28
# # celery+redis
# #BROKER_URL = 'redis://127.0.0.1:6379/0'
# #BROKER_TRANSPORT = 'redis'
# CELERY_BROKER_URL = "redis://127.0.0.1:6379/0"
# CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/0"
#
# # Celery Configuration Options
# CELERY_TIMEZONE = "Europe/Moscow"
# CELERY_TASK_TRACK_STARTED = True
# CELERY_TASK_TIME_LIMIT = 30 * 60
#
# # celery+rabbitmq
# # sudo apt install rabbitmq-server
# # django-dramatiq-email
# DRAMATIQ_EMAIL_TASK_CONFIG = {
# "max_retries": 20,
# "min_backoff": 15000,
# "max_backoff": 86400000,
# "queue_name": "my_custom_queue"
# }
# django-dramatiq
DRAMATIQ_BROKER = {
"BROKER": "dramatiq.brokers.rabbitmq.RabbitmqBroker",
"OPTIONS": {
"url": "amqp://localhost:5672",
},
"MIDDLEWARE": [
"dramatiq.middleware.Prometheus",
"dramatiq.middleware.AgeLimit",
"dramatiq.middleware.TimeLimit",
"dramatiq.middleware.Callbacks",
"dramatiq.middleware.Retries",
"django_dramatiq.middleware.DbConnectionsMiddleware",
"django_dramatiq.middleware.AdminMiddleware",
]
}
# Defines which database should be used to persist Task objects when the
# AdminMiddleware is enabled. The default value is "default".
DRAMATIQ_TASKS_DATABASE = "default"
# DRAMATIQ_RESULT_BACKEND = {
# "BACKEND": "dramatiq.results.backends.redis.RedisBackend",
# "BACKEND_OPTIONS": {
# "url": "redis://localhost:6379",
# },
# "MIDDLEWARE_OPTIONS": {
# "result_ttl": 60000
# }
# }
# django-view-breadcrumbs
BREADCRUMBS_HOME_LABEL = 'Главная'
# django-htmlmin
# "CKEDITOR FILE BROWSER" DON'T WORK WITH THIS HTML-MINIFICATOR!!!
# HTML_MINIFY = False # DO NOT ACTIVATE!!! THIS VALUE IN SHOULD BE FALSE!
HTML_MINIFY = ENABLE_HTML_MINIFY
# WHEN YOU WANT TO SELECT A FILE IN THE FILER BROWSER,
# YOU WILL GET AN LITTLE ERROR IN JS!! TRUST ME!
KEEP_COMMENTS_ON_MINIFYING = False
EXCLUDE_FROM_MINIFYING = (
'^admin/',
# '^filer/',
# '^filebrowser_filer/',
# '^dashboard/',
)
# custom settings
HTML_MINIFY_ON_ADMIN = False
# django-debug-toolbar
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
'debug_toolbar.panels.profiling.ProfilingPanel',
# django-debug-toolbar-template-timings
'template_timings_panel.panels.TemplateTimings.TemplateTimings',
]
# django-ckeditor
CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_UPLOAD_SLUGIFY_FILENAME = False
CKEDITOR_FILENAME_GENERATOR = 'project.utils.ckeditor_generate_filename'
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_RESTRICT_BY_DATE = True
CKEDITOR_BROWSE_SHOW_DIRS = False
CKEDITOR_IMAGE_BACKEND = 'pillow'
CKEDITOR_THUMBNAIL_SIZE = (100, 100)
CKEDITOR_FORCE_JPEG_COMPRESSION = True
CKEDITOR_IMAGE_QUALITY = 80
CKEDITOR_ALLOW_NONIMAGE_FILES = False
X_FRAME_OPTIONS = 'SAMEORIGIN'
CKEDITOR_CONFIGS = {
'default': {
'skin': 'moono',
#'skin': 'office2013',
'toolbar_Basic': [
['Source', '-', 'Bold', 'Italic']
],
'toolbar_CustomConfig': [
{'name': 'document', 'items': ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates']},
{'name': 'clipboard', 'items': ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
{'name': 'editing', 'items': ['Find', 'Replace', '-', 'SelectAll']},
{'name': 'links', 'items': ['Link', 'Unlink', 'Anchor']},
# {'name': 'forms',
# 'items': ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
# 'HiddenField']},
'/',
{'name': 'basicstyles',
'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
{'name': 'paragraph',
'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-',
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl',
'Language']},
{'name': 'insert',
'items': [
#'Image',
# 'FilerImage', # used for Filer
# 'Flash',
'Table', 'HorizontalRule', 'Smiley', 'SpecialChar',
'PageBreak', 'Iframe']},
'/',
{'name': 'images',
'items': [
'Image']},
{'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize']},
{'name': 'colors', 'items': ['TextColor', 'BGColor']},
{'name': 'tools', 'items': ['Maximize', 'ShowBlocks']},
# {'name': 'about', 'items': ['About']},
# '/', # put this to force next toolbar on new line
{'name': 'yourcustomtools', 'items': [
# put the name of your editor.ui.addButton here
'Preview',
'Maximize',
]},
],
'toolbar': 'CustomConfig', # put selected toolbar config here
# 'toolbarGroups': [{ 'name': 'document', 'groups': [ 'mode', 'document', 'doctools' ] }],
# 'height': 291,
# 'width': '100%',
# 'filebrowserWindowHeight': 725,
# 'filebrowserWindowWidth': 940,
# 'toolbarCanCollapse': True,
# 'mathJaxLib': '//cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML',
'tabSpaces': 4,
'extraPlugins': ','.join([
'uploadimage', # the upload image feature
# your extra plugins here
'div',
'autolink',
'autoembed',
'embedsemantic',
'autogrow',
# 'devtools',
'widget',
'lineutils',
'clipboard',
'dialog',
'dialogui',
'elementspath',
# 'filerimage', # used for Filer
]),
# 'removePlugins': 'image', # used for Filer
}
}
# https://891rpm.com/django-postgresql-guide/
# sudo apt-get install postgresql postgresql-server-dev
# zottau@dev:~$ sudo su - postgres
# postgres@dev:~$ psql
# psql (12.5 (Ubuntu 12.5-0ubuntu0.20.10.1))
# Type "help" for help.
#
# postgres=# ALTER USER zhriza_user CREATEDB;
# ALTER ROLE
# postgres=# \q
# postgres@dev:~$ exit
# logout
# zottau@dev:~$
XMPP_ENABLED = True
XMPP_DOMAIN = 'localhost'
XMPP_BOSH_SERVICE_URL = 'http://localhost:5280/http-bind'
XMPP_CONVERSEJS_SETTINGS = {
'allow_contact_removal': False,
'allow_contact_requests': True,
'auto_subscribe': True,
'allow_logout': False,
'allow_muc': True,
'allow_otr': False,
'allow_registration': False,
'message_carbons': True,
'hide_muc_server': True,
'use_vcards': True,
'animate': True,
'play_sounds': True,
'xhr_user_search': True,
'sounds_path': '%ssounds/' % STATIC_URL,
'visible_toolbar_buttons': {
'call': False,
'clear': False,
'emoticons': True,
'toggle_participants': False,
}
}
# django-prometheus
# Don't forgot to install Prometheus:
# sudo apt install prometheus
# sudo apt install prometheus-alertmanager
# sudo apt install prometheus-blackbox-exporter
# sudo apt install prometheus-nginx-exporter
# sudo apt install prometheus-node-exporter
# sudo apt install prometheus-node-exporter-collectors
PROMETHEUS_USER_SIGNED_UP = Counter(
"django_users_signed_up",
"The number of users that signed up in total.",
)
PROMETHEUS_LATENCY_BUCKETS = (.1, .2, .5, .6, .8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.5, 9.0, 12.0, 15.0, 20.0, 30.0, float("inf"))
# Project's vars
PROJECT_SEARCH_KEYWORDS_LIST = 90
PROJECT_SEARCH_KEYWORDS_HINTS_LIST = 6
SUMMERNOTE_THEME = 'bs4'
SUMMERNOTE_CONFIG = {
# Using SummernoteWidget - iframe mode, default
'iframe': True,
# # Or, you can set it to `False` to use SummernoteInplaceWidget by default - no iframe mode
# # In this case, you have to load Bootstrap/jQuery sources and dependencies manually.
# # Use this when you're already using Bootstrap/jQuery based themes.
# 'iframe': False,
# You can put custom Summernote settings
'summernote': {
# As an example, using Summernote Air-mode
'airMode': False,
# Change editor size
'width': '100%',
'height': '450',
# Use proper language setting automatically (default)
'lang': 'ru-RU',
'fontNames': ['Russo One', 'Roboto'],
'fontNamesIgnoreCheck': ['Roboto', 'Russo One'],
# 'lineHeights': ['0.2', '0.3', '0.4', '0.5', '0.6', '0.8', '1.0', '1.2', '1.4', '1.5', '2.0', '3.0'],
'dialogsInBody': False,
'fontSizeUnits': ['px', 'pt'],
# Toolbar customization
# https://summernote.org/deep-dive/#custom-toolbar-popover
'toolbar': [
['undo', ['undo']],
['redo', ['redo']],
['style', ['style']],
['font', [
'bold',
# 'italic',
'underline',
# 'superscript',
# 'subscript',
# 'strikethrough',
'clear'
]],
['fontname', ['fontname']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', [
'link',
'picture',
'video',
'hr'
]],
['view', [
'fullscreen',
'codeview'
]],
['help', ['help']],
],
# # Or, explicitly set language/locale for editor
# 'lang': 'ko-KR',
# ...
# You can also add custom settings for external plugins
'print': {
'stylesheetUrl': '/some_static_folder/printable.css',
},
'codemirror': {
'mode': 'htmlmixed',
'lineNumbers': 'true',
# You have to include theme file in 'css' or 'css_for_inplace' before using it.
'theme': 'monokai',
},
},
# Require users to be authenticated for uploading attachments.
'attachment_require_authentication': True,
# # Set `upload_to` function for attachments.
# 'attachment_upload_to': my_custom_upload_to_func(),
'attachment_upload_to': 'uploads/wysiwyg_storage/',
# # Set custom storage class for attachments.
# 'attachment_storage_class': 'my.custom.storage.class.name',
# # Set custom model for attachments (default: 'django_summernote.Attachment')
# 'attachment_model': 'my.custom.attachment.model', # must inherit 'django_summernote.AbstractAttachment'
# You can completely disable the attachment feature.
'disable_attachment': False,
# # Set to `True` to return attachment paths in absolute URIs.
# 'attachment_absolute_uri': False,
# # test_func in summernote upload view. (Allow upload images only when user passes the test)
# # https://docs.djangoproject.com/en/2.2/topics/auth/default/#django.contrib.auth.mixins.UserPassesTestMixin
# ```
# def example_test_func(request):
# return request.user.groups.filter(name='group_name').exists()
# ```
# 'test_func_upload_view': example_test_func,
# # You can add custom css/js for SummernoteWidget.
# 'css': (
# ),
# 'js': (
# ),
# # You can also add custom css/js for SummernoteInplaceWidget.
# # !!! Be sure to put {{ form.media }} in template before initiate summernote.
# 'css_for_inplace': (
# ),
# 'js_for_inplace': (
# ),
# Codemirror as codeview
# If any codemirror settings are defined, it will include codemirror files automatically.
'css': (
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.29.0/theme/monokai.min.css',
),
# Lazy initialization
# If you want to initialize summernote at the bottom of page, set this as True
# and call `initSummernote()` on your page.
'lazy': True,
# # To use external plugins,
# # Include them within `css` and `js`.
# 'js': {
# '/some_static_folder/summernote-ext-print.js',
# '//somewhere_in_internet/summernote-plugin-name.js',
# },
}
# From Django 3.0, this setting is necessary for iframe
X_FRAME_OPTIONS: str = 'SAMEORIGIN'