Answer the question
In order to leave comments, you need to log in
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)
Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question