diff --git a/apps/auth/templates/auth/login.html b/apps/auth/templates/auth/login.html index 6db81cb1..861ed328 100644 --- a/apps/auth/templates/auth/login.html +++ b/apps/auth/templates/auth/login.html @@ -5,7 +5,7 @@ {% include "templates/blocks/header.html" with no_auth_btn=True %}
-
+
Авторизация
{% csrf_token %} diff --git a/apps/auth/templates/auth/password_reset.html b/apps/auth/templates/auth/password_reset.html index 05377160..8563d244 100644 --- a/apps/auth/templates/auth/password_reset.html +++ b/apps/auth/templates/auth/password_reset.html @@ -5,7 +5,7 @@ {% include "templates/blocks/header.html" with no_auth_btn=True %}
-
+
Восстановление пароля
{% csrf_token %} diff --git a/apps/auth/templates/auth/registration-learner.html b/apps/auth/templates/auth/registration-learner.html index fd223391..46480246 100644 --- a/apps/auth/templates/auth/registration-learner.html +++ b/apps/auth/templates/auth/registration-learner.html @@ -5,7 +5,7 @@ {% include "templates/blocks/header.html" with no_auth_btn=True %}
-
+
Регистрация
{% csrf_token %} diff --git a/apps/payment/tasks.py b/apps/payment/tasks.py index e30f4e19..cc2e2f03 100644 --- a/apps/payment/tasks.py +++ b/apps/payment/tasks.py @@ -55,4 +55,11 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status key = settings.ROISTAT_KEY url = settings.ROISTAT_API_URL + f'/project/add-orders?key={key}&project={project}' resp = requests.post(url, json=body) - logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp)) + try: + resp_json = resp.json() + except: + resp_json = None + if resp.status_code != 200 or not resp_json or not resp_json.get('processed'): + logger.error('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % (payment_id, amount, resp.text)) + else: + logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp)) diff --git a/project/settings.py b/project/settings.py index 0cfc970e..75d0013e 100644 --- a/project/settings.py +++ b/project/settings.py @@ -162,6 +162,68 @@ USE_L10N = True # USE_TZ = True +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + }, + 'require_debug_true': { + '()': 'django.utils.log.RequireDebugTrue' + } + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s:%(name)s: %(message)s ' + '(%(asctime)s; %(filename)s:%(lineno)d)', + 'datefmt': "%Y-%m-%d %H:%M:%S", + }, + 'simple': { + 'format': '{levelname} {message}', + 'style': '{', + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'console': { + 'level': 'DEBUG', + 'filters': ['require_debug_true'], + 'class': 'logging.StreamHandler', + 'formatter': 'verbose', + }, + 'log_file': { + 'level': 'INFO', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': 'logs/main.log', + 'maxBytes': 1024 * 1024 * 5, # 5 MB + 'backupCount': 7, + 'formatter': 'verbose', + 'filters': ['require_debug_false'], + }, + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins', 'console'], + 'level': 'ERROR', + 'propagate': True, + }, + 'django': { + 'handlers': ['console', ], + }, + 'py.warnings': { + 'handlers': ['console', ], + }, + '': { + 'handlers': ['console', 'log_file',], + 'level': "INFO", + }, + } +} # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/