The likely issue then is the fact that you stuck your algorithm in 
mathsite/utils.py. Thus it is within your sites code.

If mathsite/__init__.py is not just an empty file and instead drags in other 
parts of your code or Django, then you will infect your algorithm code even if 
the algorithm code doesn't use Django itself.

The only way around that would be to split the utils.py function out into a 
separate package.

Thus, parallel to mathsite directory create a directory mathutils. In that 
create an empty __init__.py and then move mathsite/utils.py and any other non 
web site files it uses into mathsite.

You would then be importing mathutils.utils instead of mathsite.utils.

So you are separating the two code bases so they are independent.

I am going to sleep now. See if you can work out what I mean by that and 
collect together than other information I asked about the install location of 
the 'django' package and what is in the httpd.conf file.

Right now it almost appears like you accidentally uninstalled django.

Graham

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

> The reason is not in settings.
> I just use reverse function.
> When I removed it, new error appeared, connected with Django logging.
> But I don't use logging.
> 
> On Friday, February 27, 2015 at 1:54:19 PM UTC+2, Graham Dumpleton wrote:
> 
> 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.

-- 
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