On Saturday, January 23, 2016 at 11:38:31 AM UTC+1, James Schneider wrote:
>
>
> On Jan 20, 2016 2:35 AM, "Det S. Pillner" <silve...@gmail.com 
> <javascript:>> wrote:
> >
> > Hi all,
> >
> > I work on a django project. I use very heavy logging in this project. 
> Some parts of code needs to start over a cron job outside of the django 
> project. In this - I call it modules - I try to use my existing django 
> logging config. Code execution displays no errors bud there are no logging 
> entries.
> >
> > Can somebody help to fix my problem?
> >
>
> Are you bring in your entire Django environment via a django.setup() call, 
> or are you simply trying to import the logging configuration that is being 
> used by your Django project?
>
> Without some explanation of what you've tried, I don't think we have 
> enough information to help.
>
> -James
>

Oh Sorry for the late answer. Holiday.

Here is the content of my bash script to call one of the modules that I use 
from outside of Django:


  
# django/python settings

PYTHONPATH="${PYTHONPATH}:/srv/wpkg_webtools/"
export PYTHONPATH
export DJANGO_SETTINGS_MODULE=wpkg_webtools.settings.privat

# call python part (django module)
python /srv/wpkg_webtools/wpkg/modules/fill.py $1


This script is called from a cron job and find.

In my module I use this:

import os
import os.path
import glob
import sys
import xml.etree.ElementTree as eTree
import logging
import logging.config
import logging.handlers
from time import gmtime, strftime

from django.db import connection

from wpkg.models.wpkg import *

logger = logging.getLogger('imp')  # global logger for fill


I does not get a error message. That means: Python can find all things. And 
below: a part from settings.py:

'imp': {
    'handlers': ['import'],
    'level': 'DEBUG',
},


This logger is used by other parts IN django also.

Thanks for your reaction. I will try django.setup() in the head of my 
module.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/30a968e4-4464-489f-ad7d-502f3b695f44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to