D
D
Dauren S2016-10-27 17:10:30
Django
Dauren S, 2016-10-27 17:10:30

Select not showing in logs in django?

When I launch django through runserver and make a selection, then I print print (articles)
in the console, everything is displayed.
In production, I do it through logging

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': '/path/to/django/debug.log',
        },
    },
    'loggers': {
        'news': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}

import logging
logger = logging.getLogger(__name__)

def show_from_cat(request,url):
    category=Category.objects.get(url__exact=url)
    
    child=Category.objects.filter(parent_id=category.id)
    articles=Article.objects.filter(Q(category__id=category.id) | Q(category__id__in=(child)),published=1).order_by('-created')
    logger.debug(articles)

But no selection is shown.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dauren S, 2016-11-03
@dauren101

because of the encoding it turns out
that if I do arr=['d','f','s']
logger.debug(arr), then it 's fine
if arr=['d','w','s']
logger.debug( arr), not written

S
sim3x, 2016-10-27
@sim3x

stackoverflow.com/questions/15054988/combining-que...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question