HEX
Server: nginx/1.29.3
System: Linux mail.sarafai.ru 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: dl,exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: //proc/682/cwd/project/settings.py
import os
import sys
from datetime import datetime
from pathlib import Path

from django.conf.urls.static import static
from django.utils.translation import gettext_lazy as _

from project.todo import todo_func


BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = 'django-insecure-&wx)#7*)+osj5v(0n2_^9&1@lz3@9)0l%dsnn=&%&3cb3s2c8$'


DEBUG = True

TEMPLATE_DEBUG = DEBUG

CDN_USE = False

# Caching in client browsers
CACHE_MAIN_JS = False
CACHE_MAIN_CSS = False

SITE_ID = 1

DEMO = False

ALLOWED_HOSTS = [
    '127.0.0.1',
    'localhost',
    '82.148.16.210',
    'sarafai.com',
    'www.sarafai.com',
    'sarafai.ru',
    'www.sarafai.ru',
    'dev.sarafai.ru',
    '192.168.48.129',  # vmware
    '192.168.0.101',  # Dev notebook
    '192.168.178.52',  # akado inet
    '*'
]

INTERNAL_IPS = [
    "127.0.0.1",
]


# django-cors
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOWED_ORIGINS = [
    'http://127.0.0.1:8000',
    'http://localhost:8080',

    'http://82.148.16.210',
    'https://82.148.16.210',
    'https://sarafai.com',
    'https://www.sarafai.com',
    'http://sarafai.com',
    'http://www.sarafai.com',

    'https://sarafai.ru',
    'https://www.sarafai.ru',
    'http://sarafai.ru',
    'http://www.sarafai.ru',

    'http://92.243.179.24',  # Dev notebook
]
CORS_ORIGIN_WHITELIST = [
    "http://localhost:8000",
    "http://127.0.0.1:8000",
]


CSRF_TRUSTED_ORIGINS = CORS_ALLOWED_ORIGINS
CSRF_USE_SESSIONS = False
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'sarafai_csrf'

INSTALLED_APPS = [
    'apps.dashboard.apps.DashboardConfig',

    # django-modeltranslation
    'modeltranslation',

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'django.contrib.sites',
    'django.contrib.sitemaps',
    'django.contrib.humanize',

    'rest_framework',
    'corsheaders',

    'debug_toolbar',
    'django_extensions',
    'solo.apps.SoloAppConfig',

    # MERGE

    # # Project apps
    'apps.shop.apps.ShopConfig',
    'apps.cart.apps.CartConfig',
    'apps.orders.apps.OrdersConfig',

    # 'paypal',
    # 'paypal.standard.ipn',

    'apps.cupons.apps.CuponsConfig',
    # 'apps.pages_articles',
    'apps.homepage.apps.HomepageConfig',
    'apps.core.apps.CoreConfig',
    'apps.feedback.apps.FeedbackConfig',
    'apps.api.apps.ApiConfig',
    # 'apps.pages.apps.PagesConfig',
    'apps.delivery.apps.DeliveryConfig',
    'apps.payment.apps.PaymentConfig',
    'apps.settings.apps.SettingsConfig',

    'apps.account.apps.AccountConfig',

    'apps.my.apps.MyConfig',

    'apps.return_app.apps.ReturnAppConfig',

    #
    # # Third-party apps
    # # 'redactor',
    # # 'easy_thumbnails',

    # 'ckeditor',
    # 'ckeditor_uploader',

    # # 'mptt',
    # # 'filer',
    # 'ckeditor_filebrowser_filer',

    'macros',
    'phonenumber_field',
    # 'packages.static_sitemaps',
    'static_sitemaps',
    'rosetta',

    'crispy_forms',
    'crispy_bootstrap5',

    'imagekit',

    'packages.snowpenguin.django.recaptcha3',

    'drf_yasg',
    'drf_spectacular',
    'drf_spectacular_sidecar',
    'adrf',

]

MIDDLEWARE = [

    # django-debug-toolbar
    'debug_toolbar.middleware.DebugToolbarMiddleware',

    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',

    # django-cors-headers
    'corsheaders.middleware.CorsMiddleware',

    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    # django-htmlmin
    'htmlmin.middleware.HtmlMinifyMiddleware',
    'htmlmin.middleware.MarkRequestMiddleware',

    # 'core.middleware.CurrentUserMiddleware'

]

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',

                # MERGE

                'apps.cart.context_processors.cart',
                'apps.core.context_processors.debug',
                'apps.core.context_processors.demo',
                'apps.core.context_processors.project',

                'apps.core.context_processors.cache_main_js',
                'apps.core.context_processors.cache_main_css',
                'apps.core.context_processors.next',
                'apps.core.context_processors.payment_demo',

                'apps.core.context_processors.next',  # TODO: Refactor func name
                # 'apps.core.context_processors.project_new',

                # Context processor for static/media files
                'django.template.context_processors.media',
            ],

            # MERGE
            'libraries': {
                'shuffle': 'apps.core.templatetags.shuffle',
                'load_css': 'apps.core.templatetags.load_resource',
                'load_js': 'apps.core.templatetags.load_resource',
                'load_js_res': 'apps.core.templatetags.load_resource',
                'load_css_res': 'apps.core.templatetags.load_resource',
            }
        },
    },
]

WSGI_APPLICATION = 'project.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

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',
    },
]

LANGUAGE_CODE = 'ru'

LANGUAGES = (
    ('ru', _('Russian')),
    # ('en', _('English')),
)

LOCALE_PATHS = [
    BASE_DIR / 'locale/',
]

# Rosetta
# django-admin makemessages -l ru
# django-admin makemessages -l en
# django-admin compilemessages

# django-modeltranslation
MODELTRANSLATION_DEBUG = False
MODELTRANSLATION_DEFAULT_LANGUAGE = 'ru'
# MODELTRANSLATION_TRANSLATION_REGISTRY = 'project.translation'
MODELTRANSLATION_LANGUAGES = ('ru', 'en')
MODELTRANSLATION_PREPOPULATE_LANGUAGE = 'en'
MODELTRANSLATION_TRANSLATION_FILES = (
    'apps.delivery.translation',
    # 'apps.homepage.translation',
    # 'apps.orders.translation',
    'apps.pages.translation',
    'apps.payment.translation',
    'apps.shop.translation',
)


TIME_ZONE = 'Europe/Moscow'

USE_I18N = True

USE_L10N = True

USE_TZ = True

DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S"
# Snippet date
# date_time = datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S')

MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'  # TODO: Move to "uploads"

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'

STATICSITEMAPS_ROOT_DIR = 'sitemaps'

STATICFILES_DIRS = (
    BASE_DIR / 'static_files/',
    BASE_DIR / 'media/',
    STATICSITEMAPS_ROOT_DIR,
)
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# 2021.11.12
# info@sarafai.com
# yE4hF8cV3vM9aD7q


# django-htmlmin
HTML_MINIFY = True
EXCLUDE_FROM_MINIFYING = ('^admin_sarafai/',)
KEEP_COMMENTS_ON_MINIFYING = False


# MERGE 2021.11.17

# django-recaptcha3
RECAPTCHA_PRIVATE_KEY = '6LdEgjceAAAAAMsRlTMIKKUZNp5iyBGMjdtW6LBB'
RECAPTCHA_PUBLIC_KEY = '6LdEgjceAAAAAFFfQJCwV26CjH3RIFPwZ0RKwBdW'
RECAPTCHA_DEFAULT_ACTION = 'generic'
RECAPTCHA_SCORE_THRESHOLD = 0.5
# RECAPTCHA_LANGUAGE = 'en' # for auto detection language, remove this from your settings
# If you require reCaptcha to be loaded from somewhere other than https://google.com
# (e.g. to bypass firewall restrictions), you can specify what proxy to use.
# RECAPTCHA_FRONTEND_PROXY_HOST = 'https://recaptcha.net'


SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
SESSION_COOKIE_HTTPONLY = True

# SESSION_COOKIE_AGE = 24 * 60 * 60  # Production
# SESSION_COOKIE_AGE = 14 * 24 * 60 * 60
SESSION_COOKIE_AGE = 14 * 24 * 60 * 60  # Production from 2025-02-19
# SESSION_COOKIE_DOMAIN = 'sarafai.com'
# SESSION_COOKIE_SECURE = not DEBUG
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_SAVE_EVERY_REQUEST = False

# Session ID
CART_SESSION_ID = 'sarafai_cart'


# Email
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
ADMINS = (
    ('Mikhail', '891rpm@gmail.com'),
    ('Zigfrid', 'zottau@gmail.com'),
)
MANAGERS = ADMINS

# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.yandex.ru'
EMAIL_HOST_USER = 'robot@sarafai.com'
EMAIL_HOST_PASSWORD = 'ynf9nVwVLXS6TFpZ'
PROJECT_EMAIL_MODE = 'SSL'

if PROJECT_EMAIL_MODE == 'TLS':
    EMAIL_PORT = 587
    EMAIL_USE_TLS = True
    EMAIL_USE_SSL = False
elif PROJECT_EMAIL_MODE == 'SSL':
    EMAIL_PORT = 465
    EMAIL_USE_TLS = False
    EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

PROJECT_EMAIL = 'info@sarafai.com'

MAIL_SUBJECT = 'Запрос обратного звонка с сайта SARAFAI.RU'
MAIL_MESSAGE = 'Поступил запрос на обратный звонок с сайта:<br><br>' \
               'Телефон: <h3>%s</h3><br><br>' \
               '--<br>' \
               '<b>sarafai.ru</b>' % '1293761823'
MAIL_FROM_EMAIL = 'сарафай <robot@sarafai.com>'
if DEBUG:
    MAIL_TO_EMAIL = '891rpm@gmail.com'
else:
    MAIL_TO_EMAIL = '891rpm@gmail.com', 'shop@sarafai.com'
MAIL_REPLY_TO = 'shop@sarafai.com'
MAIL_HEADERS = {'Reply-To': MAIL_REPLY_TO}
MAIL_CONTENT = 'html'
MAIL_BACKEND = 'EmailMessage'


# Celery 5
# # broker_url = 'amqp://localhost'
# broker_url = 'pyamqp://'
# result_backend = 'rpc://'
# result_persistent = False
# # accept_content = ['application/json']
# accept_content = ['json']
# task_serializer = 'json'
# result_serializer = 'json'
# timezone = 'Europe/Moscow'
# enable_utc = True
timezone = "Europe/Moscow"
CELERY_TASK_TRACK_STARTED = True
CELERY_TASK_TIME_LIMIT = 30 * 60
CELERY_TASK_REPETITION = 5 * 60
# celery -A project worker -l info


# RabbitMQ
# 0. Install RabbitMQ
# sudo apt install rabbitmq-server
# 1. Enable Web management plugin
# sudo rabbitmq-plugins enable rabbitmq_management
# 2. Add user
# sudo rabbitmqctl add_user USER PASSWORD
# 3. User permissions
# sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
# sudo rabbitmqctl set_user_tags username administrator
# Work
# sudo systemctl status rabbitmq-server

# RabbitMQ on Windows
# 1. Go to https://www.rabbitmq.com/install-windows.html#installer
# 2. Download last from https://erlang.org/download/otp_versions_tree.html
# 3. Install Erlang
# 4. Download https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.10.6/rabbitmq-server-3.10.6.exe
# 5. Install RabbitMQ Server
# 5.5. STOP RABBITMQ SERVICE! AND THEN START RABBITMQ SERVER!
# 6. Start RabbitMQ Server as an Administrator
#      C:\Program Files\RabbitMQ Server\rabbitmq_server-3.10.6\sbin>rabbitmq-server.bat
# 7. Enter to the project Env
#      C:\projects\sarafai\src>..\env\Scripts\activate
# 8. Run Celery (don't forgot install it: "pip install celery")
#      celery -A project worker -l info --pool=solo


# # Paypal
# PAYPAL_RECEIVER_EMAIL = 'zottau@gmail.com'
# PAYPAL_TEST = True


# django-ckeditor
CKEDITOR_JQUERY_URL = 'https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_ALLOW_NONIMAGE_FILES = False
CKEDITOR_UPLOAD_SLUGIFY_FILENAME = False
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_BROWSE_SHOW_DIRS = True
CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': (
            ['div', 'Source', '-', 'Save', 'NewPage', 'Preview', '-', 'Templates'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Print', 'SpellChecker', 'Scayt'],
            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
            ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
            ['Link', 'Unlink', 'Anchor'],
            ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'],
            ['Styles', 'Format', 'Font', 'FontSize'],
            ['TextColor', 'BGColor'],
            ['Maximize', 'ShowBlocks', '-', 'About', 'pbckcode', '-'],
            # ['FilerImage'],
        ),
        # 'extraPlugins': 'filerimage',
        # 'removePlugins': 'image'
    },
}


# django-static-sitemaps
STATICSITEMAPS_ROOT_SITEMAP = 'project.sitemaps.sitemaps'
# STATICSITEMAPS_USE_GZIP = True
# STATICSITEMAPS_GZIP_METHOD = ['python', 'system']
# STATICSITEMAPS_SYSTEM_GZIP_PATH = BASE_DIR / 'sitemaps'
# STATICSITEMAPS_URL = '/static/sitemaps'
STATICSITEMAPS_URL = 'https://sarafai.ru/static/sitemaps'
# cron task
# django-admin.py refresh_sitemap


# easy_thumbnails
THUMBNAIL_ALIASES = {
    '': {
        # 'thumbnail-avatar': {'size': (100, 100), 'crop': True},
        # # 'thumbnail-xs': {'size': (50, 50), 'crop': True},
        # # 'thumbnail-m': {'size': (100, 100), 'crop': True},
        # 'thumbnail-l': {'size': (150, 0), 'crop': True},
        # 'thumbnail-xl': {'size': (200, 0), 'crop': 'smart', 'autocrop': True, 'upscale': True},
        # 'thumbnail-xxl': {'size': (400, 0), 'crop': True},
        # 'thumbnail-xxxl': {'size': (800, 0), 'crop': True},
        # 'thumbnail-xxxxl': {'size': (1024, 0), 'crop': True},

        'thumbnail': {'size': (100, 200), 'crop': True},
        'image': {'size': (1080, 1920), 'crop': True},
    },
}
THUMBNAIL_BASEDIR = ''
THUMBNAIL_CACHE_DIMENSIONS = False
THUMBNAIL_CHECK_CACHE_MISS = False
THUMBNAIL_DEBUG = True
THUMBNAIL_DEFAULT_OPTIONS = None  # {'bw': True}
THUMBNAIL_DEFAULT_STORAGE = 'easy_thumbnails.storage.ThumbnailFileSystemStorage'
THUMBNAIL_EXTENSION = 'png'
THUMBNAIL_HIGHRES_INFIX = '@2x'
THUMBNAIL_HIGH_RESOLUTION = True
THUMBNAIL_MEDIA_ROOT = ''
THUMBNAIL_MEDIA_URL = ''
THUMBNAIL_NAMER = 'easy_thumbnails.namers.hashed'  # default / hashed / source_hashed / hashed
THUMBNAIL_PREFIX = ''
THUMBNAIL_PRESERVE_EXTENSIONS = None  # ('png',)
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',
    'easy_thumbnails.processors.background',
)
THUMBNAIL_PROGRESSIVE = 100
THUMBNAIL_QUALITY = 85
THUMBNAIL_SOURCE_GENERATORS = ('easy_thumbnails.source_generators.pil_image',)
THUMBNAIL_SUBDIR = ''
THUMBNAIL_TRANSPARENCY_EXTENSION = 'png'

# django-phonenumber-field
PHONENUMBER_DB_FORMAT = 'INTERNATIONAL'  # 'E164', 'INTERNATIONAL', 'RFC3966'
# PHONENUMBER_DEFAULT_REGION = 'Russia'


# # Sentry
# import sentry_sdk
# from sentry_sdk.integrations.django import DjangoIntegration
#
# sentry_sdk.init(
#     dsn="https://c61a79f5e5784e52a42df2626bde5a8e@o166389.ingest.sentry.io/6080048",
#     integrations=[DjangoIntegration()],
#
#     # Set traces_sample_rate to 1.0 to capture 100%
#     # of transactions for performance monitoring.
#     # We recommend adjusting this value in production.
#     traces_sample_rate=1.0,
#
#     # If you wish to associate users to errors (assuming you are using
#     # django.contrib.auth) you may enable sending PII data.
#     send_default_pii=True
# )


# django-user-accounts
# LOGIN_REDIRECT_URL = 'profile_view'
LOGIN_REDIRECT_URL = 'my'
# LOGOUT_REDIRECT_URL = 'homepage_view'
LOGOUT_REDIRECT_URL = '/'


# crispy-bootstrap5
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap5'
CRISPY_TEMPLATE_PACK = 'bootstrap5'


# django-rest-framework
REST_FRAMEWORK = {
    # Use Django's standard `django.contrib.auth` permissions,
    # or allow read-only access for unauthenticated users.
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
    ],
    'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',

    # 'DEFAULT_PERMISSION_CLASSES': (
    #     'rest_framework.permissions.IsAdminUser',
    # ),
    # 'DEFAULT_RENDERER_CLASSES': (
    #     'rest_framework.renderers.JSONRenderer',
    #     #'rest_framework.renderers.BrowsableAPIRenderer',
    # ),

    'PAGINATE_BY': 10,
    'PAGINATE_BY_PARAM': 'page_size',
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 10,
}

SPECTACULAR_SETTINGS = {
    'TITLE': 'SARAFAI API',
    'DESCRIPTION': 'Sarafai custom api',
    'VERSION': '1.0.0',
    'SERVE_INCLUDE_SCHEMA': False,
    'SWAGGER_UI_DIST': 'SIDECAR',
    'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
    'REDOC_DIST': 'SIDECAR',

    'OAS_VERSION': '3.0.3',
    'SWAGGER_UI_SETTINGS': {
        'deepLinking': True,
    },
    # Optional: MAY contain "name", "url", "email"
    'CONTACT': {
        'name': 'Mikhail Romanov',
        'email': '891rpm@gmail.com'
    },

    # A regex specifying the common denominator for all operation paths. If
    # SCHEMA_PATH_PREFIX is set to None, drf-spectacular will attempt to estimate
    # a common prefix. Use '' to disable.
    # Mainly used for tag extraction, where paths like '/api/v1/albums' with
    # a SCHEMA_PATH_PREFIX regex '/api/v[0-9]' would yield the tag 'albums'.
    # 'SCHEMA_PATH_PREFIX': None,
    'SCHEMA_PATH_PREFIX': '/api/v[0-9]',
}

# FIX. Create directory ../logs for LOGGING feature
Path('../logs/').mkdir(parents=True, exist_ok=True)


LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'console': {
            'format': '%(name)-12s %(levelname)-8s %(message)s'
        },
        'file': {
            'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
        },
        'colored': {
            '()': 'apps.core.logs.djangocolors_formatter.DjangoColorsFormatter',
            'format': '%(levelname)s %(module)s %(message)s',
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            # 'formatter': 'console',
            'formatter': 'colored',
        },
        # 'file': {
        #     'level': 'DEBUG',
        #     'class': 'logging.FileHandler',
        #     'formatter': 'file',
        #     'filename': '../logs/debug.log'
        # }
    },
    'root': {
        # 'handlers': ['console', 'file'],
        'handlers': ['console'],
        # 'handlers': ['colored', 'file'],
        'level': 'DEBUG',
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            # 'level': 'DEBUG',
            'level': 'INFO',
            'propagate': False,
        },
    },

}


# SARAFAI.COM settings
PROJECT_SETTINGS = {
    'client': {
        'email_style': 'html'
    },
    'project': {
        'name': 'сарафай',
        'name_2': 'Сарафай',
        'url': 'https://sarafai.ru',
        'url_short': 'sarafai.ru',
        'description': '',
        'keywords': '',
        'slogan': 'одежда от производителя',
        # 'phone': '+7 926 079-01-07',
        # 'phone_short': '+79260790107',
        # 'phone_work_time': 'Пн-Вс, 10-19',
        # 'phone_work_time_stat': '10',
        # 'phone_work_time_end': '19',
        'email': 'shop@sarafai.com',  # Deprecated
        'email_manager': 'robot@sarafai.com',  # Deprecated
        # 'email_notification': MAIL_TO_EMAIL,  # Deprecated
        'email_icon': 'fa fa-envelope-o',
        'email_subject_prefix': 'SARAFAI.RU',
        'logo_small': 'images/logo.png',
        'logo_large': 'images/logo_large.png',
        'datetime_format': '%Y-%m-%d %H:%M:%S',

        'contacts': {
            'email': 'shop@sarafai.com',
            'email_manager': 'robot@sarafai.com',
            # 'email_notification': MAIL_TO_EMAIL,

            # 'link_facebook': 'http://facebook.com/',
            # 'link_instagram': 'http://instagram.com/',
            'link_vk': 'https://vk.com/sarafai',
            'link_pinterest': 'https://pinterest.com/',
        },

        # 'map_code': '<script type="text/javascript" charset="utf-8" async
        # src="https://api-maps.yandex.ru/services/constructor/1.0/js/?um=
        # constructor%3Abdb18e891f69800bd88c1d1a7c9caf7e73a79e3b5debf048d1357b6c1253bd0f&amp;
        # width=100%25&amp;height=450&amp;lang=ru_RU&amp;scroll=false"></script>',

        # 'address': {
        #     'country': 'Российская Федерация',
        #     'region': 'Московская область, Люберецкий район',
        #     'location': 'д. Марусино',
        #     'street': 'Новомарусинский проезд',
        #     'office': 'д. 1',
        #     'postal_code': '140009',
        #     'warehouse': 'Московская область, Люберецкий район, д. Марусино, Новомарусинский проезд,
        #     д. 1, офис 1 (1-й этаж)',
        #     'legal': '140009, Российская Федерация, Московская область, Люберецкий район, д. Марусино,
        #     Новомарусинский проезд, д. 1',
        # },
        # 'requisites': {
        #     'line_0': 'ИП Михайлов Рамиль Равильевич',
        #     'line_1': 'ИНН: 503302637229',
        #     'line_2': 'КПП: 123456789',
        #     'line_3': 'ОГРН: 313501222400049',
        #     'line_4': 'Расчетный счет: 4080 2810 3000 0004 2250',
        #     'line_5': 'Банк: ПАО "ПРОМСВЯЗЬБАНК"',
        #     'line_6': 'Банковские реквизиты: БИК 044525555',
        #     'line_7': 'Корреспондентский счет: 30101810400000000555',
        #     'line_8': 'ОКПО: 40148343',
        #     'line_9': 'SWIFT: PRMSRUMMXXX',
        # },
        'copyright': f"&copy; 2021-{datetime.now().strftime('%Y')}. Сарафай. Все права защищены.",
        'msvalidate_01': '',
        'google_site_verification': '0ItdOZQ862Z7L0wIrqwHhUnSGWOYYX6fMcDhF2RWnjQ',
        'yandex_verification': 'c1246c226830043c',
        'recaptcha': RECAPTCHA_PUBLIC_KEY,
        'cdn': CDN_USE,
        'debug': DEBUG,

        'show_header': False,

        # # Shop Settings
        # 'payment': {
        #     # 'type_1': {
        #     #     'name': 'Оплата наличными',
        #     #     'slug': 'cash',
        #     #     'description': 'Оплата наличными производится: <ul class="uk-list uk-list-bullet">'
        #     #                    '<li>курьеру при получении заказа,</li>'
        #     #                    '<li>в почтовом отделении при получении посылки</li>'
        #     #                    '<li>или при самовывозе из нашего магазина.</li>'
        #     #                    '</ul>',
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        #     'type_2': {
        #         'name': _('Оплата банковской картой'),
        #         'slug': 'card',
        #         'description': 'Процесс оплаты начнется после указания вами данных для
        #         доставки и подтверждения заказа.',
        #         'status': 'enabled',
        #         'visibility': 'true',
        #         'image': '<div class="ps-5 mb-4"><img alt="" class="p-2"
        #         src="/static/img/payment/mastercard_logo.svg" style="width: 4rem;"><img alt=""
        #         class="p-2" src="/static/img/payment/visa_logo.svg" style="width: 4rem;"><img alt=""
        #         class="p-2" src="/static/img/payment/mir_logo.svg" style="width: 4rem;"></div>'
        #     },
        #     # 'type_3': {
        #     #     'name': 'Квитанция Сбербанка (банковский перевод для физических лиц)',
        #     #     'slug': 'sberbank_pd4',
        #     #     'description': '<span class="text-warning">Оплата с помощью квитанции Сбербанка '
        #     #                    'временно недоступна.<br>Приносим свои извинения.</span>',
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        #     # 'type_4': {
        #     #     'name': 'Безналичный расчет (банковский перевод для юридических лиц)',
        #     #     'slug': 'requisites',
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        #     # 'type_5': {
        #     #     'name': 'Платежная система PayPal (только для физических лиц)',
        #     #     'slug': 'paypal',
        #     #
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        #     # 'type_6': {
        #     #     'name': 'Оплата банковской картой',
        #     #     'slug': 'card',
        #     #     'description': '<span class="text-warning">Оплата заказа банковской картой временно недоступна.<br>'
        #     #                    'Приносим свои извинения.</span>',
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        #     # 'type_7': {
        #     #     'name': 'Оплата <Метод #7>',
        #     #     'slug': 'payment_method_7',
        #     #     'description': '',
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        #     # 'type_8': {
        #     #     'name': 'Оплата <Метод #8>',
        #     #     'slug': 'payment_method_8',
        #     #     'description': '',
        #     #     'status': 'disabled',
        #     #     'visibility': 'false',
        #     # },
        # },

        'delivery': {
            # ('courier_service_dpd', 'Курьерская служба DPD'),
            # ('courier_service_cdek', 'Курьерская служба СДЭК'),
            # ('courier_service_boxberry', 'Курьерская служба BoxBerry'),
            'type_1': {
                'name': 'Курьер магазина',
                'slug': 'courier',
                'cost': '300',  # RUB
                'cost_moscow_in': '0',  # RUB
                'cost_moscow_out': '300',  # RUB
                'cost_moscow_out_km': '50',  # RUB
                'cost_region_min': '300',
                'cost_region_km': '50',  # RUB
                'region': 'Заказы доставляются по Москве и Московской области',
                'conditions': 'Курьер доставляет товар с 10:00-20:00, по рабочим дням и в субботу - Пн-Сб',
                'status': 'disabled',
                'visibility': 'false',
                'position': 4,
                'image': ''
            },
            'type_2': {
                'name': 'Почта России',
                'slug': 'russian_post',
                'link': 'pochta.ru',
                'cost': '0',
                'status': 'enabled',
                'visibility': 'true',
                'position': 1,
                'image': '<img id="delivery_image" src="/static/img/delivery/pochta_logo.svg" '
                         'style="width:100px; height:48px;" alt="">'
            },
            'type_3': {
                'name': 'Самовывоз со склада магазина',
                'slug': 'customer_pickup',
                'cost': '0',
                'status': 'disabled',
                'visibility': 'false',
                'position': 3,
                'image': ''
            },
            'type_4': {
                'name': 'СДЭК',
                'slug': 'cdek',
                'link': 'cdek.ru',
                'cost': '0',
                'status': 'enabled',
                'visibility': 'true',
                'position': 2,
                'image': ''
            },
            'type_5': {
                'name': 'Достависта',
                'slug': 'dostavista',
                'link': 'dostavista.ru',
                'cost': '0',
                'status': 'enabled',
                'visibility': 'true',
                'position': 5,
                'image': ''
            },
        },
        # 'minimum_delivery_cost': '300',  # RUB
        # 'minimum_order_price': '0',  # RUB
        # 'minimum_qty': '1',  # items
    }
}


# SMS.RU provider
SMSRU_API_TOKEN = 'ab7d585e-edaa-2914-1902-8b06317ff73f'
SMSRU_URL = 'https://sms.ru/sms/send'
SMSRU_FROM_LABEL = 'sarafai'
# SMSRU_URL_W_PARAMS = f'https://sms.ru/sms/send?api_id={SMSRU_API}&to={TO}&msg={message}&json=1'
TO_MANAGER_PHONE = '79057717277'
# TO_MANAGER_PHONE = '79057717277,79680148842'


# Work with Celery and RabbitMQ
# 1. sudo systemctl status rabbitmq-server
#
# 2. celery -A project worker -l debug
# 2. [PROD] celery -A project worker -l info
#
# 3. celery -A project flower --address=127.0.0.1 --port=5566
#

# TINKOFF_TERMINAL_KEY = '1643719737320'
# TINKOFF_TERMINAL_PASSWORD = 's9jg22ax0t37dpeq'
TINKOFF_TERMINAL_KEY = '1643719737320DEMO'
TINKOFF_TERMINAL_PASSWORD = 'c5nh6y1wic3v3o4n'
TINKOFF_DEMO = True
# TINKOFF_PROCESSING_RESPONSE_URL = 'https://sarafai.com/api/processing/'
TINKOFF_PROCESSING_RESPONSE_URL = 'https://sarafai.ru/api/v1/payment/processing/'


# Project errors solutions

# ERROR: OSError: cannot load library 'pango-1.0-0': pango-1.0-0: cannot open shared object file:
# No such file or directory.
# Additionally, ctypes.util.find_library() did not manage to locate a library called 'pango-1.0-0'
# SOLUTION: apt install libpangocairo-1.0-0

# ERROR: (Windows 10):
# OSError: cannot load library 'gobject-2.0-0': error 0x7e.  Additionally, ctypes.util.find_library() did not manage
# to locate a library called 'gobject-2.0-0'
# SOLUTION:
# Install the library GTK3
# Step 1.: Download the MSYS2 installer that matches your platform and follow the installation instructions.
# https://github.com/msys2/msys2-installer/releases/download/2022-06-03/msys2-x86_64-20220603.exe
#
# Step 2.: Install GTK3 and its dependencies. Open a MSYS2 shell, and run:
# pacman -S mingw-w64-x86_64-gtk3
#
# Step 3. (optional): If you want to develop a GTK3 application in Python, you need to install the Python bindings.
# pacman -S mingw-w64-x86_64-python3-gobject
#
# Step 4. (optional): Install the build tools. If you want to develop a GTK3 application in other languages like C,
# C++, Fortran, etc, you’ll need a compiler like gcc and other development tools:
# pacman -S mingw-w64-x86_64-toolchain base-devel


# GeoLite2

# GeoLite2 Databases
# wget -P GeoLite2 https://github.com/P3TERX/GeoLite.mmdb/releases/download/2022.04.10/GeoLite2-ASN.mmdb
# wget -P GeoLite2 https://github.com/P3TERX/GeoLite.mmdb/releases/download/2022.04.10/GeoLite2-City.mmdb
# wget -P GeoLite2 https://github.com/P3TERX/GeoLite.mmdb/releases/download/2022.04.10/GeoLite2-Country.mmdb
# wget -P GeoLite2 https://github.com/P3TERX/GeoLite.mmdb/archive/refs/tags/2022.04.10.zip
# wget -P GeoLite2 https://github.com/P3TERX/GeoLite.mmdb/archive/refs/tags/2022.04.10.tar.gz

# GeoLite2 Libs
# https://github.com/maxmind/libmaxminddb/

USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')


DADATA_TOKEN = "3f4350b3a2e723442a5c167c6355d6b737abb44f"
DADATA_SECRET = "cf8022c21335dacaf52ac0d9299231084592c582"


# TODO & TASKS
if DEBUG:
    todo_func()