On 27/02/2015, at 11:15 AM, Paul Royik <[email protected]> wrote:

> I don't use database, but use settings and it keeps telling me, that settings 
> and logging are not initialised.

Why do you have to have your algorithm dependent on Django settings?

As I have noted, this is not a good idea as it means you will pull in quite a 
lot of Dango code into your algorithm process. Sort of partly defeats the 
purpose of doing it, as part of the reason was so that it doesn't use as much 
memory so you can handle having more of them running in parallel.

> 
> class RunableProcessing(multiprocessing.Process):
>     def __init__(self, func, *args, **kwargs):
>         self.queue = multiprocessing.Manager().Queue(maxsize=1)
>         args = (func,) + args
>         multiprocessing.Process.__init__(self, target=self.run_func, 
> args=args, kwargs=kwargs)
> 
>     def run_func(self, func, *args, **kwargs):
>         try:
>             result = func(*args, **kwargs)
>             self.queue.put((True, result))
>         except Exception as e:
>             self.queue.put((False, e))
> 
>     def done(self):
>         return self.queue.full()
> 
>     def result(self):
>         return self.queue.get()
> 
> import django
> django.setup()
Next is that I don't think that calling django.setup() alone like that will 
work.

Where are you setting DJANGO_SETTINGS environment variable for that?

Anyway, the messages indicate that Django cannot even be found by your existing 
WSGI script application.

Where was the Django module installed. That is, run:

    python2.7

and in the interpreter do:

    import django
    print django.__file__

What do you get.

Also look in the 'httpd.conf' file generated in the 'express' directory where 
'apachectl' is held.

Find in that file the WSGIPythonHome directive.

Copy and send me from WSGIPythonHome down to the end of the second 
WSGIDaemonProcess directive just below that.

Also go way down the end of the httpd.conf file and find the 
WSGIDaemonProcess/WSGIImportScript directives at the end. Send me that one as 
well.

Note that those WSGIDaemonProcess directives span multiple lines, so I want 
more than the first line. Eg,

WSGIDaemonProcess 'service:xxx' \
    display-name=%{GROUP} \
    user='${WSGI_RUN_USER}' \
    group='${WSGI_RUN_GROUP}' \
    home='/Users/graham/Projects/mod_wsgi' \
    threads=1 \
    python-path='' \
    python-eggs='/tmp/mod_wsgi-localhost:8000:502/python-eggs' \
    lang='en_AU.UTF-8' \
    locale='en_AU.UTF-8'
WSGIImportScript '/Users/graham/Projects/mod_wsgi/task-queue-manager.py' \
    process-group='service:xxx' \
    application-group=%{GLOBAL}

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to