I
I
Ivan Tuzhilkin2016-03-07 12:47:02
Django
Ivan Tuzhilkin, 2016-03-07 12:47:02

There is a Server Error 500 error when trying to add an article from the admin panel, somehow connected with the transition to http2, the logs do not help, where to dig?

Moved the site to http2 with a certificate from Let's Encript. After that, when I try to add an article (using CKEditor) via Django Admin (add/post), a Server Error 500 occurs. Tags, categories, images are easily added to the server. Nginx, Gunicorn logs switched to Debug mode do not give any information. Where to dig? I have a suspicion that the error may be somehow related to the transfer of html code from the add / post form, maybe some kind of escaping. I'm at a dead end.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Voronkov, 2016-03-07
@Ivan_Tuzhilkin

Set up logging once in production and catch errors by mail.
Does anyone even read the documentation?

ADMINS = (('Your nam.', '[email protected]'),)
...
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.yandex.ru' # or google
EMAIL_HOST_PASSWORD = 'password'
EMAIL_HOST_USER = 'login'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = DEFAULT_FROM_EMAIL
EMAIL_PORT = 465
EMAIL_USE_SSL = True
...
LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s '
                      '%(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'null': {
            'level': 'DEBUG',
            'class': 'django.utils.log.NullHandler',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
        },
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler',
            'include_html': True,
        }
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'propagate': True,
            'level': 'INFO',
        },
        'django.db': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': True,
        },
        'django.request': {
            'handlers': ['mail_admins', 'console'],
            'level': 'ERROR',
            'propagate': False,
        },
    }
}

B
blackbb, 2016-03-08
@blackbb

Thank you all, the issue was resolved when I started a user other than root.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question